You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/08/24 00:57:58 UTC
[incubator-doris] branch doris-manager updated: [Manager] Submit
Doris manager code (#6487)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch doris-manager
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/doris-manager by this push:
new e0af276 [Manager] Submit Doris manager code (#6487)
e0af276 is described below
commit e0af276becf9f51298be5a6c44a17425a1efc1db
Author: songchuanyuan <46...@users.noreply.github.com>
AuthorDate: Tue Aug 24 08:57:39 2021 +0800
[Manager] Submit Doris manager code (#6487)
All the codes of the current commercial version of Doris manager are uploaded, including unified cluster space management, user system, cluster monitoring and data construction.
---
manager/build.sh | 9 +
manager/checkstyle/studio_checks.xml | 299 +++++
manager/checkstyle/suppressions.xml | 23 +
manager/conf/manager.conf | 57 +
manager/dm-agent/pom.xml | 6 -
.../doris/manager/agent/DmAgentApplication.java | 7 +-
.../doris/manager/agent/api/CommandController.java | 1 +
.../doris/manager/agent/api/CommonControllder.java | 2 +-
.../doris/manager/agent/command/BeCommand.java | 5 +-
.../manager/agent/command/BeInstallCommand.java | 1 +
.../manager/agent/command/BeInstallTaskDesc.java | 1 +
.../manager/agent/command/BeInstallTaskHook.java | 3 +-
.../manager/agent/command/BeStartCommand.java | 1 +
.../doris/manager/agent/command/BeStopCommand.java | 2 +-
.../doris/manager/agent/command/Command.java | 3 +-
.../manager/agent/command/CommandFactory.java | 1 +
.../manager/agent/command/CommandListener.java | 1 +
.../doris/manager/agent/command/CommandResult.java | 1 +
.../agent/command/CommandResultService.java | 1 +
.../doris/manager/agent/command/FeCommand.java | 5 +-
.../manager/agent/command/FeInstallCommand.java | 1 +
.../manager/agent/command/FeInstallTaskDesc.java | 1 +
.../manager/agent/command/FeInstallTaskHook.java | 2 +-
.../manager/agent/command/FeStartCommand.java | 1 +
.../doris/manager/agent/command/FeStopCommand.java | 1 +
.../manager/agent/command/ListenerCommand.java | 3 +-
.../doris/manager/agent/common/AgentConstants.java | 1 +
.../doris/manager/agent/common/PropertiesUtil.java | 6 +-
.../manager/agent/exception/AgentException.java | 2 +-
.../agent/exception/GlobalExceptionHandler.java | 7 +-
.../doris/manager/agent/register/AgentContext.java | 3 +-
.../manager/agent/register/AgentHeartbeat.java | 17 +-
.../manager/agent/register/AgentRegister.java | 5 +-
.../doris/manager/agent/register/AgentRole.java | 1 +
.../manager/agent/register/ApplicationOption.java | 1 +
.../doris/manager/agent/register/BaseRequest.java | 18 +-
.../doris/manager/agent/register/BeState.java | 10 +-
.../doris/manager/agent/register/FeState.java | 10 +-
.../doris/manager/agent/register/StateService.java | 1 +
.../manager/agent/task/AbsAsyncTaskHandler.java | 1 +
.../manager/agent/task/ITaskHandlerFactory.java | 1 +
.../apache/doris/manager/agent/task/ITaskLog.java | 1 +
.../org/apache/doris/manager/agent/task/LRU.java | 1 +
.../manager/agent/task/QueuedTaskHandler.java | 1 +
.../agent/task/QueuedTaskHandlerFactory.java | 4 +-
.../doris/manager/agent/task/ScriptTask.java | 2 +-
.../doris/manager/agent/task/ScriptTaskDesc.java | 1 +
.../doris/manager/agent/task/SyncTaskHandler.java | 2 +
.../manager/agent/task/SyncTaskHandlerFactory.java | 4 +-
.../org/apache/doris/manager/agent/task/Task.java | 6 +-
.../doris/manager/agent/task/TaskContext.java | 9 +-
.../apache/doris/manager/agent/task/TaskDesc.java | 1 +
.../manager/agent/task/TaskExecutorService.java | 3 +-
.../doris/manager/agent/task/TaskHandler.java | 1 +
.../manager/agent/task/TaskHandlerFactory.java | 1 +
.../apache/doris/manager/agent/task/TaskHook.java | 17 +
.../doris/manager/agent/task/TaskLruLog.java | 2 +-
.../doris/manager/agent/task/TaskResult.java | 1 +
.../apache/doris/manager/agent/task/TaskState.java | 1 +
.../src/main/resources/application.properties | 2 +-
.../dm-agent/src/main/resources/logback-spring.xml | 17 +
.../common/domain/BeInstallCommandRequestBody.java | 4 +-
.../manager/common/domain/CommandRequest.java | 2 +
.../doris/manager/common/domain/CommandType.java | 1 +
.../common/domain/FeInstallCommandRequestBody.java | 1 +
.../common/domain/FeStartCommandRequestBody.java | 1 +
.../doris/manager/common/domain/RResult.java | 1 +
.../apache/doris/manager/common/domain/Role.java | 1 +
manager/dm-server/pom.xml | 36 +-
.../manager/server/dao/impl/ServerDaoImpl.java | 160 ---
.../doris/manager/server/entity/AgentEntity.java | 103 --
.../server => stack}/DmServerApplication.java | 3 +-
.../server => stack}/agent/AgentCache.java | 17 +-
.../agent/AgentHeatbeatRunner.java | 36 +-
.../{manager/server => stack}/agent/AgentRest.java | 3 +-
.../doris/stack/component/AgentComponent.java | 73 ++
.../config/RestTemplateConfig.java | 4 +-
.../server => stack}/constants/AgentStatus.java | 3 +-
.../server => stack}/constants/CmdTypeEnum.java | 3 +-
.../server => stack}/constants/Constants.java | 9 +-
.../controller/AgentController.java | 16 +-
.../controller/ServerController.java | 19 +-
.../dao/AgentRepository.java} | 43 +-
.../doris/stack/dao/AgentRoleRepository.java} | 19 +-
.../entity/AgentEntity.java} | 48 +-
.../doris/stack/entity/AgentRoleEntity.java} | 34 +-
.../exceptions/GlobalExceptionHandler.java | 9 +-
.../exceptions/ServerException.java | 8 +-
.../server/model => stack}/req/AgentCommon.java | 3 +-
.../server/model => stack}/req/DorisExec.java | 3 +-
.../server/model => stack}/req/DorisExecReq.java | 3 +-
.../model => stack}/req/DorisInstallReq.java | 3 +-
.../server/model => stack}/req/InstallInfo.java | 3 +-
.../server/model => stack}/req/SshInfo.java | 3 +-
.../server/model => stack}/req/TaskInfoReq.java | 3 +-
.../server/model => stack}/req/TaskLogReq.java | 5 +-
.../server => stack}/service/ServerAgent.java | 12 +-
.../server => stack}/service/ServerProcess.java | 13 +-
.../service/impl/ServerAgentImpl.java | 56 +-
.../service/impl/ServerProcessImpl.java | 70 +-
.../server => stack}/shell/BaseCommand.java | 16 +-
.../doris/{manager/server => stack}/shell/SCP.java | 3 +-
.../doris/{manager/server => stack}/shell/SSH.java | 3 +-
.../server => stack}/util/Preconditions.java | 3 +-
.../server => stack}/util/PropertiesUtil.java | 8 +-
.../src/main/resources/application.properties | 23 +-
.../src/main/resources/logback-spring.xml | 16 +
...216\245\345\217\243\346\226\207\346\241\243.md" | 8 +-
...203\250\347\275\262\346\226\207\346\241\243.md" | 52 +
manager/general/pom.xml | 33 +
.../stack/component/ClusterUserComponent.java | 183 +++
.../doris/stack/component/IdaasComponent.java | 160 +++
.../doris/stack/component/LdapComponent.java | 269 +++++
.../doris/stack/component/MailComponent.java | 460 ++++++++
.../doris/stack/component/SettingComponent.java | 273 +++++
.../stack/component/UserActivityComponent.java | 69 ++
.../apache/doris/stack/connector/LdapClient.java | 163 +++
.../apache/doris/stack/constant/ConstantDef.java | 114 ++
.../doris/stack/constant/EnvironmentDefine.java | 100 ++
.../doris/stack/constant/PropertyDefine.java | 82 ++
.../doris/stack/controller/BaseController.java} | 49 +-
.../doris/stack/controller/UtilController.java | 56 +
.../stack/controller/config/EmailController.java | 93 ++
.../stack/controller/config/IdaasController.java | 70 ++
.../stack/controller/config/LdapController.java | 70 ++
.../stack/controller/config/SettingController.java | 126 +++
.../controller/user/AuthenticationController.java | 116 ++
.../stack/controller/user/UserController.java | 218 ++++
.../apache/doris/stack/dao/ActivityRepository.java | 51 +
.../doris/stack/dao/ClusterInfoRepository.java | 42 +
.../doris/stack/dao/CoreSessionRepository.java | 61 +
.../apache/doris/stack/dao/CoreUserRepository.java | 53 +
.../doris/stack/dao/LoginHistoryRepository.java} | 29 +-
.../dao/PermissionsGroupMembershipRepository.java | 64 ++
.../stack/dao/PermissionsGroupRoleRepository.java | 56 +
.../apache/doris/stack/dao/SettingRepository.java | 41 +
.../doris/stack/dao/StudioSettingRepository.java} | 31 +-
.../doris/stack/dao/SuperUserRepository.java | 46 +
.../apache/doris/stack/entity/ActivityEntity.java | 140 +++
.../doris/stack/entity/ClusterInfoEntity.java | 138 +++
.../doris/stack/entity/CoreSessionEntity.java} | 43 +-
.../apache/doris/stack/entity/CoreUserEntity.java | 211 ++++
.../doris/stack/entity/LoginHistoryEntity.java | 71 ++
.../entity/PermissionsGroupMembershipEntity.java | 59 +
.../stack/entity/PermissionsGroupRoleEntity.java | 67 ++
.../apache/doris/stack/entity/SettingEntity.java} | 37 +-
.../doris/stack/entity/StudioSettingEntity.java} | 36 +-
.../doris/stack/entity/StudioSettingEntityPk.java} | 21 +-
.../doris/stack/entity/SuperUserEntity.java} | 38 +-
.../stack/exception/AuthorizationException.java} | 17 +-
.../stack/exception/BadRequestException.java} | 11 +-
.../stack/exception/DorisConnectionException.java} | 14 +-
.../exception/DorisSpaceDuplicatedException.java} | 14 +-
.../doris/stack/exception/EmailSendException.java} | 18 +-
.../stack/exception/HdfsUnknownHostException.java} | 14 +-
.../doris/stack/exception/HdfsUrlException.java} | 12 +-
.../stack/exception/IdaasConnectionException.java} | 14 +-
.../stack/exception/IdaasNotExistException.java} | 15 +-
.../doris/stack/exception/InputDataException.java} | 13 +-
.../stack/exception/InputFormatException.java} | 12 +-
.../stack/exception/InvalidDataException.java} | 15 +-
.../stack/exception/LdapConnectionException.java} | 14 +-
.../stack/exception/LdapNotExistException.java} | 15 +-
.../stack/exception/MetaDataSyncException.java} | 11 +-
.../stack/exception/NameDuplicatedException.java} | 13 +-
.../exception/NoAdminPermissionException.java} | 14 +-
.../stack/exception/NoPermissionException.java} | 14 +-
.../stack/exception/PaloRequestException.java} | 11 +-
.../stack/exception/PasswordFormatException.java} | 13 +-
.../exception/RequestFieldNullException.java} | 18 +-
.../stack/exception/ResetPasswordException.java} | 14 +-
.../exception/ResetPasswordTokenException.java} | 18 +-
.../doris/stack/exception/SqlSyntaxException.java} | 13 +-
.../stack/exception/StudioInitException.java} | 15 +-
.../stack/exception/StudioNotInitException.java} | 15 +-
.../doris/stack/exception/UnknownException.java} | 10 +-
.../stack/exception/UserDisabledException.java} | 14 +-
.../exception/UserEmailDuplicatedException.java} | 14 +-
.../UserFailedLoginTooManyException.java} | 14 +-
.../doris/stack/exception/UserLoginException.java} | 12 +-
.../exception/UserLoginTooManyException.java} | 14 +-
.../stack/exception/UserNotExistException.java} | 14 +-
.../stack/model/activity/ActivityInfoResp.java | 177 +++
.../stack/model/activity/ActivityModelType.java} | 16 +-
.../stack/model/activity/ActivityViewInfoResp.java | 91 ++
.../doris/stack/model/activity/ModelObject.java} | 44 +-
.../apache/doris/stack/model/activity/Topic.java} | 29 +-
.../stack/model/ldap/LdapConnectionInfo.java} | 34 +-
.../doris/stack/model/ldap/LdapUserInfo.java} | 27 +-
.../doris/stack/model/ldap/LdapUserInfoReq.java} | 23 +-
.../doris/stack/model/meta/DataBaseResp.java | 445 ++++++++
.../apache/doris/stack/model/meta/TableResp.java | 402 +++++++
.../model/request/config/ConfigUpdateReq.java | 93 ++
.../stack/model/request/config/EmailInfo.java | 172 +++
.../model/request/config/IdaasSettingReq.java | 53 +
.../stack/model/request/config/InitStudioReq.java} | 26 +-
.../stack/model/request/config/LdapSettingReq.java | 105 ++
.../model/request/config/StudioSettingReq.java} | 15 +-
.../stack/model/request/config/TestEmailReq.java} | 10 +-
.../model/request/space/ClusterCreateReq.java} | 43 +-
.../request/space/ClusterInitValidateReq.java} | 32 +-
.../stack/model/request/space/ClusterType.java} | 14 +-
.../model/request/space/UserSpaceCreateReq.java | 72 ++
.../model/request/space/UserSpaceUpdateReq.java} | 30 +-
.../model/request/user/PasswordResetReq.java} | 35 +-
.../model/request/user/PasswordUpdateReq.java | 61 +
.../stack/model/request/user/UserAddReq.java} | 46 +-
.../stack/model/request/user/UserGroupRole.java} | 12 +-
.../stack/model/request/user/UserLoginReq.java} | 32 +-
.../stack/model/request/user/UserSpaceReq.java} | 30 +-
.../stack/model/request/user/UserUpdateReq.java} | 31 +-
.../doris/stack/model/response/config/GeoInfo.java | 61 +
.../stack/model/response/config/IdaasResult.java} | 42 +-
.../model/response/config/IdaasSettingResp.java} | 26 +-
.../model/response/config/LdapSettingResp.java} | 39 +-
.../model/response/config/PasswordComplexity.java} | 18 +-
.../model/response/config/PremiumFeatures.java} | 29 +-
.../model/response/config/SessionSettingResp.java | 1192 +++++++++++++++++++
.../stack/model/response/config/SettingItem.java | 92 ++
.../stack/model/response/config/Version.java} | 23 +-
.../stack/model/response/config/VersionInfo.java} | 20 +-
.../stack/model/response/space/UserSpaceInfo.java} | 52 +-
.../stack/model/response/user/GroupMember.java | 69 ++
.../model/response/user/PasswordResetResp.java} | 37 +-
.../model/response/user/UserGroupMembership.java | 69 ++
.../doris/stack/model/response/user/UserInfo.java | 278 +++++
.../org/apache/doris/stack/rest/ResponseBody.java | 93 ++
.../doris/stack/rest/ResponseEntityBuilder.java | 70 ++
.../doris/stack/rest/RestApiExceptionHandler.java | 94 ++
.../doris/stack/rest/RestApiStatusCode.java} | 23 +-
.../apache/doris/stack/service/BaseService.java} | 32 +-
.../apache/doris/stack/service/UtilService.java | 226 ++++
.../doris/stack/service/config/ConfigCache.java | 143 +++
.../doris/stack/service/config/ConfigConstant.java | 379 +++++++
.../doris/stack/service/config/ConfigItem.java | 166 +++
.../doris/stack/service/config/ConfigValueDef.java | 97 ++
.../doris/stack/service/config/EmailService.java | 177 +++
.../doris/stack/service/config/IdaasService.java | 87 ++
.../doris/stack/service/config/LdapService.java | 87 ++
.../doris/stack/service/config/SettingService.java | 341 ++++++
.../stack/service/user/AuthenticationService.java | 1193 ++++++++++++++++++++
.../doris/stack/service/user/UserService.java | 675 +++++++++++
.../org/apache/doris/stack/util/CredsUtil.java | 104 ++
.../java/org/apache/doris/stack/util/ListUtil.java | 119 ++
.../org/apache/doris/stack/util/LogBuilder.java | 113 ++
.../org/apache/doris/stack/util/PropertyUtil.java | 250 ++++
.../org/apache/doris/stack/util/UuidUtil.java} | 28 +-
.../doris/stack/component/LdapComponentTest.java | 220 ++++
.../doris/stack/component/MailComponentTest.java | 248 ++++
.../stack/component/SettingComponentTest.java | 359 ++++++
.../stack/service/config/EmailServiceTest.java | 208 ++++
.../stack/service/config/LdapServiceTest.java | 115 ++
.../stack/service/config/SettingServiceTest.java | 376 ++++++
.../service/user/AuthenticationServiceTest.java | 794 +++++++++++++
.../doris/stack/service/user/UserServiceTest.java | 762 +++++++++++++
manager/manager-bin/start_manager.sh | 100 ++
manager/manager-bin/stop_manager.sh | 20 +
manager/manager-server/pom.xml | 70 ++
.../java/org/apache/doris/stack/DorisManager.java | 65 ++
.../apache/doris/stack/ManagerSwaggerConfig.java | 55 +
.../org/apache/doris/stack/StartManagerRunner.java | 52 +
.../doris/stack/controller/IndexController.java} | 28 +-
.../stack/controller/PaloUserSpaceController.java | 139 +++
.../doris/stack/service/PaloUserSpaceService.java | 497 ++++++++
.../src/main/resources/logback-spring.xml | 170 +++
.../src/main/resources/mail/_footer.mustache | 9 +
.../src/main/resources/mail/_footer_pulse.mustache | 11 +
.../src/main/resources/mail/_header.mustache | 15 +
.../src/main/resources/mail/_logo.mustache | 3 +
.../resources/mail/alert_new_confirmation.mustache | 4 +
.../resources/mail/alert_unsubscribed.mustache | 3 +
.../main/resources/mail/alert_was_deleted.mustache | 4 +
.../resources/mail/alert_you_were_added.mustache | 5 +
.../main/resources/mail/new_user_invite.mustache | 25 +
.../main/resources/mail/password_reset.mustache | 15 +
.../mail/user_joined_notification.mustache | 26 +
.../stack/service/PaloUserSpaceServiceTest.java | 592 ++++++++++
manager/manager/pom.xml | 49 +
.../doris/stack/component/DatabuildComponent.java | 50 +
.../stack/component/ManagerMetaSyncComponent.java | 351 ++++++
.../stack/component/ManagerMetaSynchronizer.java | 60 +
.../stack/connector/HttpClientPoolManager.java | 335 ++++++
.../apache/doris/stack/connector/PaloClient.java | 77 ++
.../stack/connector/PaloFileUploadClient.java | 186 +++
.../stack/connector/PaloForwardManagerClient.java | 80 ++
.../doris/stack/connector/PaloLoginClient.java | 56 +
.../doris/stack/connector/PaloMetaInfoClient.java | 143 +++
.../doris/stack/connector/PaloMonitorClient.java | 441 ++++++++
.../doris/stack/connector/PaloQueryClient.java | 143 +++
.../doris/stack/connector/PaloStatisticClient.java | 60 +
.../controller/construct/ClusterController.java | 59 +
.../controller/construct/DataImportController.java | 155 +++
.../controller/construct/DataManageController.java | 122 ++
.../controller/construct/MetadataController.java | 128 +++
.../construct/NativeQueryController.java | 61 +
.../controller/manager/PaloManagerController.java | 230 ++++
.../controller/monitor/PaloMonitorController.java | 127 +++
.../doris/stack/dao/DataImportTaskRepository.java | 47 +
.../doris/stack/dao/ManagerDatabaseRepository.java | 38 +
.../doris/stack/dao/ManagerFieldRepository.java} | 36 +-
.../doris/stack/dao/ManagerTableRepository.java} | 33 +-
.../doris/stack/driver/DorisDataBuildDriver.java | 310 +++++
.../doris/stack/driver/JdbcSampleClient.java | 55 +
.../doris/stack/entity/DataImportTaskEntity.java | 166 +++
.../doris/stack/entity/ManagerDatabaseEntity.java | 69 ++
.../doris/stack/entity/ManagerFieldEntity.java | 102 ++
.../doris/stack/entity/ManagerTableEntity.java | 75 ++
.../stack/model/palo/ClusterMonitorInfo.java} | 34 +-
.../stack/model/palo/ClusterOverviewInfo.java} | 34 +-
.../doris/stack/model/palo/HdfsFileInfo.java} | 23 +-
.../doris/stack/model/palo/HdfsFilePreview.java} | 42 +-
.../doris/stack/model/palo/HdfsFilePreviewReq.java | 77 ++
.../doris/stack/model/palo/HdfsImportTaskInfo.java | 141 +++
.../doris/stack/model/palo/LocalFileInfo.java} | 26 +-
.../stack/model/palo/LocalFileSubmitResult.java} | 46 +-
.../stack/model/palo/PaloResponseEntity.java} | 37 +-
.../doris/stack/model/palo/TableSchemaInfo.java | 87 ++
.../model/request/construct/DbCreateReq.java} | 20 +-
.../stack/model/request/construct/FieldInfo.java | 84 ++
.../model/request/construct/FileImportReq.java} | 23 +-
.../model/request/construct/HdfsConnectReq.java} | 32 +-
.../model/request/construct/HdfsImportReq.java} | 35 +-
.../model/request/construct/TableCreateReq.java | 147 +++
.../model/request/monitor/ClusterMonitorReq.java} | 23 +-
.../response/construct/ClusterOverviewResp.java | 52 +
.../response/construct/DataImportTaskPageResp.java | 89 ++
.../model/response/construct/DatabaseResp.java} | 23 +-
.../model/response/construct/HdfsPreviewResp.java} | 26 +-
.../model/response/construct/NativeQueryResp.java} | 44 +-
.../stack/model/response/construct/TableResp.java} | 29 +-
.../stack/service/construct/ClusterService.java | 58 +
.../stack/service/construct/DataDescription.java} | 19 +-
.../stack/service/construct/DataImportService.java | 435 +++++++
.../stack/service/construct/DataManageService.java | 216 ++++
.../stack/service/construct/MetadataService.java | 318 ++++++
.../service/construct/NativeQueryService.java | 85 ++
.../stack/service/manager/PaloManagerService.java | 69 ++
.../stack/service/monitor/PaloMonitorService.java | 160 +++
.../stack/component/DatabuildComponentTest.java | 84 ++
.../component/ManagerMetaSyncComponentTest.java | 416 +++++++
.../stack/driver/DorisDataBuildDriverTest.java | 367 ++++++
.../service/construct/DataImportServiceTest.java | 498 ++++++++
.../service/construct/DataManageServiceTest.java | 285 +++++
.../service/construct/MetadataServiceTest.java | 357 ++++++
.../service/construct/NativeQueryServiceTest.java | 131 +++
.../service/monitor/PaloMonitorServiceTest.java | 121 ++
manager/pom.xml | 223 ++++
347 files changed, 27052 insertions(+), 1605 deletions(-)
diff --git a/manager/build.sh b/manager/build.sh
new file mode 100644
index 0000000..2d1d2aa
--- /dev/null
+++ b/manager/build.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -e
+rm -rf output
+mkdir output
+mkdir -p output/
+mvn clean install
+mv manager-server/target/manager-server-1.0.0.jar output/doris-manager.jar
+cp -r conf output/
+cp manager-bin/* output/
\ No newline at end of file
diff --git a/manager/checkstyle/studio_checks.xml b/manager/checkstyle/studio_checks.xml
new file mode 100644
index 0000000..22fa113
--- /dev/null
+++ b/manager/checkstyle/studio_checks.xml
@@ -0,0 +1,299 @@
+<?xml version="1.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
+ ~
+ ~ http://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.
+ -->
+
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+ Checkstyle configuration that checks the Google coding conventions from:
+ - Google Java Style
+ https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+ Most Checks are configurable, be sure to consult the documentation.
+ To completely disable a check, just comment it out or delete it from the file.
+ Copied from https://github.com/checkstyle/checkstyle/blob/master/google_checks.xml
+ -->
+
+<module name = "Checker">
+ <property name="charset" value="UTF-8"/>
+
+ <property name="severity" value="error"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="@throw.*\.$"/>
+ <property name="message" value="Period is not needed at the end of the @throw tag."/>
+ <property name="fileExtensions" value=".java"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="@return.*\.$"/>
+ <property name="message" value="Period is not needed at the end of the @return tag."/>
+ <property name="fileExtensions" value=".java"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="@param.*\.$"/>
+ <property name="message" value="Period is not needed at the end of the @param tag."/>
+ <property name="fileExtensions" value=".java"/>
+ </module>
+ <module name="RegexpSingleline">
+<!-- <property name="format" value="TODO[^\(]"/>-->
+<!-- <property name="message" value="TODO must be annotated with the author in the format TODO(author)"/>-->
+ <property name="fileExtensions" value=".java"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value=">>>>>>>"/>
+ <property name="message" value="Merge conflicts unresolved."/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="<<<<<<<"/>
+ <property name="message" value="Merge conflicts unresolved."/>
+ </module>
+ <module name="RegexpMultiline">
+<!-- <property name="format" value="\{\n\s*\n"/>-->
+ <property name="format" value="\n{3}"/>
+ <property name="fileExtensions" value=".java"/>
+ <property name="message" value="Extra newline"/>
+ </module>
+<!-- <module name="RegexpMultiline">-->
+<!-- <property name="format" value="\n\s*\n\s*}"/>-->
+<!-- <property name="fileExtensions" value=".java"/>-->
+<!-- <property name="message" value="Extra newline at end of block"/>-->
+<!-- </module>-->
+
+ <!-- All Java AST specific tests live under TreeWalker module. -->
+ <module name="TreeWalker">
+ <module name="OuterTypeFilename"/>
+ <module name="IllegalTokenText">
+ <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
+ <property name="format"
+ value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
+ <property name="message" value="Avoid using corresponding octal or Unicode escape."/>
+ </module>
+ <module name="AvoidEscapedUnicodeCharacters">
+ <property name="allowEscapesForControlCharacters" value="true"/>
+ <property name="allowByTailComment" value="true"/>
+ <property name="allowNonPrintableEscapes" value="true"/>
+ </module>
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|^ ([\s\S]*)"/>
+ </module>
+ <module name="AvoidStarImport"/>
+ <module name="UnusedImports">
+ <property name="processJavadoc" value="true"/>
+ </module>
+ <module name="OneTopLevelClass"/>
+ <module name="NoLineWrap"/>
+ <module name="EmptyBlock">
+ <property name="option" value="TEXT"/>
+ <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF,
+ LITERAL_ELSE, LITERAL_SWITCH"/>
+ </module>
+ <module name="NeedBraces"/>
+ <module name="LeftCurly">
+<!-- <property name="maxLineLength" value="100"/>-->
+ </module>
+ <module name="RightCurly"/>
+ <module name="RightCurly">
+ <property name="option" value="alone"/>
+ <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE,
+ LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
+ </module>
+ <module name="WhitespaceAround">
+ <property name="allowEmptyConstructors" value="true"/>
+ <property name="allowEmptyMethods" value="true"/>
+ <property name="allowEmptyTypes" value="true"/>
+ <property name="allowEmptyLoops" value="true"/>
+ <message key="ws.notFollowed"
+ value="WhitespaceAround: ''{0}'' is not followed by whitespace."/>
+ <message key="ws.notPreceded"
+ value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
+ </module>
+ <module name="OneStatementPerLine"/>
+ <module name="EmptyStatement"/>
+ <module name="MultipleVariableDeclarations"/>
+ <module name="ArrayTypeStyle"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="FallThrough"/>
+ <module name="UpperEll"/>
+ <module name="ModifierOrder"/>
+ <module name="EmptyLineSeparator">
+<!-- <property name="allowNoEmptyLineBetweenFields" value="true"/>-->
+ <property name="tokens" value="PACKAGE_DEF , IMPORT , STATIC_IMPORT , CLASS_DEF , INTERFACE_DEF , ENUM_DEF , STATIC_INIT , INSTANCE_INIT , METHOD_DEF , CTOR_DEF"/>
+ </module>
+ <module name="SeparatorWrap">
+ <property name="tokens" value="DOT"/>
+ <property name="option" value="nl"/>
+ </module>
+ <module name="SeparatorWrap">
+ <property name="tokens" value="COMMA"/>
+ <property name="option" value="EOL"/>
+ </module>
+ <module name="PackageName">
+ <!-- https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html -->
+ <property name="format" value="^[a-z]+(\.[a-z_][a-z0-9_]*)*$"/>
+ <message key="name.invalidPattern"
+ value="Package name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="TypeName">
+ <message key="name.invalidPattern"
+ value="Type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+<!-- <module name="MemberName">-->
+<!-- <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>-->
+<!-- <message key="name.invalidPattern"-->
+<!-- value="Member name ''{0}'' must match pattern ''{1}''."/>-->
+<!-- </module>-->
+ <module name="ConstantName"/>
+ <module name="ParameterName">
+ <property name="format" value="[a-zA-Z0-9]*$"/>
+ <message key="name.invalidPattern"
+ value="Parameter name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="tokens" value="VARIABLE_DEF"/>
+ <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+ <property name="allowOneCharVarInForLoop" value="true"/>
+ <message key="name.invalidPattern"
+ value="Local variable name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="ClassTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
+ <message key="name.invalidPattern"
+ value="Class type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="MethodTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
+ <message key="name.invalidPattern"
+ value="Method type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="NoFinalizer"/>
+ <module name="GenericWhitespace">
+ <message key="ws.followed"
+ value="GenericWhitespace ''{0}'' is followed by whitespace."/>
+ <message key="ws.preceded"
+ value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
+ <message key="ws.illegalFollow"
+ value="GenericWhitespace ''{0}'' should followed by whitespace."/>
+ <message key="ws.notPreceded"
+ value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
+ </module>
+<!-- <module name="Indentation">-->
+<!-- <property name="basicOffset" value="2"/>-->
+<!-- <property name="braceAdjustment" value="0"/>-->
+<!-- <property name="caseIndent" value="2"/>-->
+<!-- <property name="throwsIndent" value="4"/>-->
+<!-- <property name="lineWrappingIndentation" value="4"/>-->
+<!-- <property name="arrayInitIndent" value="16"/>-->
+<!-- </module>-->
+<!-- <module name="OverloadMethodsDeclarationOrder"/>-->
+ <!-- Checks that our import order rules are followed. -->
+ <module name="CustomImportOrder">
+ <property name="specialImportsRegExp" value="alluxio"/>
+ <property name="customImportOrderRules" value="STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE"/>
+ </module>
+ <module name="MethodParamPad"/>
+ <module name="ParenPad">
+ <property name="option" value="nospace"/>
+ </module>
+ <module name="OperatorWrap">
+ <property name="option" value="NL"/>
+ <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE,
+ LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
+ </module>
+ <module name="StaticVariableName">
+<!-- <property name="format" value="^s[A-Z][a-zA-Z0-9]*$"/>-->
+ <message key="name.invalidPattern"
+ value="Static member name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="RegexpSinglelineJava">
+<!-- <property name="format" value="^\s*this\."/>-->
+<!-- <property name="message" value="keyword this is not needed"/>-->
+ </module>
+ <module name="MissingDeprecated"/>
+ <module name="EqualsHashCode"/>
+
+ <!-- Checks the Javadoc of a public method or constructor. Only applies to production code. -->
+ <module name="JavadocMethod">
+ <property name="id" value="ProductionScope"/>
+ <property name="scope" value="public"/>
+ <property name="allowMissingThrowsTags" value="true"/>
+ <property name="allowMissingPropertyJavadoc" value="true"/>
+<!-- <property name="allowMissingParamTags" value="true"/>-->
+<!-- <property name="allowMissingReturnTag" value="true"/>-->
+ <property name="tokens" value="ANNOTATION_FIELD_DEF"/>
+ </module>
+ <!-- Checks Javadoc comments for public class and interface definitions. Only applies to
+ production code -->
+<!-- <module name="JavadocType">-->
+<!-- <property name="id" value="ProductionScope"/>-->
+<!-- <property name="scope" value="public"/>-->
+<!-- </module>-->
+ <!-- Checks that Javadoc is properly formatted -->
+<!-- <module name="JavadocStyle"/>-->
+
+ <!-- Checks that there is no whitespace before various unary operators. -->
+ <module name="NoWhitespaceBefore">
+ <property name="tokens" value="POST_DEC, POST_INC"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <!-- Checks that there is no whitespace before dot and semicolon, except line-breaks. -->
+ <module name="NoWhitespaceBefore">
+ <property name="tokens" value="DOT, SEMI"/>
+ <property name="allowLineBreaks" value="true"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <!-- Checks that there is no whitespace after various unary operators. -->
+ <module name="NoWhitespaceAfter">
+ <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <!-- Checks that there is whitespace after various tokens. -->
+ <module name="WhitespaceAfter"/>
+
+ <!-- Allows SuppressionCommentFilter to access module contents. -->
+<!-- <module name="FileContentsHolder"/>-->
+ </module>
+
+ <!-- always use Unix-style line separators -->
+ <module name="NewlineAtEndOfFile">
+ <property name="lineSeparator" value="lf"/>
+ </module>
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Trailing whitespace found."/>
+ <property name="fileExtensions" value=".java"/>
+ </module>
+
+ <!-- Disables checkstyle for particular lines of codes. -->
+<!-- <module name="SuppressionCommentFilter">-->
+<!-- <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>-->
+<!-- <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>-->
+<!-- </module>-->
+</module>
diff --git a/manager/checkstyle/suppressions.xml b/manager/checkstyle/suppressions.xml
new file mode 100644
index 0000000..471fc2d
--- /dev/null
+++ b/manager/checkstyle/suppressions.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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
+ ~
+ ~ http://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.
+ -->
+
+<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+<suppressions>
+</suppressions>
\ No newline at end of file
diff --git a/manager/conf/manager.conf b/manager/conf/manager.conf
new file mode 100644
index 0000000..32c31d5
--- /dev/null
+++ b/manager/conf/manager.conf
@@ -0,0 +1,57 @@
+# 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
+#
+# http://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.
+
+# manager service database information
+#http port
+STUDIO_PORT=8080
+
+# The deployment depends on three data service types: mysql/h2/postgresql. MySQL is supported by default.
+MB_DB_TYPE=mysql
+
+# If h2 is used, only the data engine type needs to be configured, and the data will be directly saved
+# in the path of service operation in the form of file.
+# If you want to use mysql or postgresql, you need to configure the following connection information
+# Connection address
+#MB_DB_HOST=127.0.0.1
+
+# Connection port
+#MB_DB_PORT=3306
+
+# Connect access user
+#MB_DB_USER=root
+
+# Connection access user password
+#MB_DB_PASS=123456
+
+# Database accessed by the service(database)
+#MB_DB_DBNAME=manager
+
+# The name of the deployed service. The default is manager
+#DEPLOY_NAME=manager
+
+# The default port of the deployed nginx service is 8090. If nginx is not deployed, 8080 will be used directly
+# NGINX_PORT=8080
+
+# Operation and maintenance mailbox of the current Doris manage service instance
+#DS_ADMIN_EMAIL=
+
+# The name of the current Doris manage service instance is as follows by default and
+# can be customized and modified according to the actual situation
+# DS_SITE_NAME=Baidu-Doris-Manager
+
+# The language of the current Doris manage service instance is Chinese (zh) by default, and can support zh and en
+# DS_SITE_LOCALE=zh
diff --git a/manager/dm-agent/pom.xml b/manager/dm-agent/pom.xml
index 890b71f..8914b66 100644
--- a/manager/dm-agent/pom.xml
+++ b/manager/dm-agent/pom.xml
@@ -35,12 +35,6 @@
</dependency>
<dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.61</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/DmAgentApplication.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/DmAgentApplication.java
index 791ab1d..c2c84b7 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/DmAgentApplication.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/DmAgentApplication.java
@@ -14,8 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.agent.register.AgentContext;
import org.apache.doris.manager.agent.register.AgentHeartbeat;
import org.apache.doris.manager.agent.register.AgentRegister;
@@ -25,15 +27,13 @@ import org.apache.doris.manager.common.domain.Role;
import org.apache.doris.manager.agent.common.PropertiesUtil;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.system.ApplicationHome;
@SpringBootApplication
+@Slf4j
public class DmAgentApplication {
- private static final Logger log = LoggerFactory.getLogger(DmAgentApplication.class);
public static void main(String[] args) {
ApplicationOption option = new ApplicationOption();
@@ -52,7 +52,6 @@ public class DmAgentApplication {
AgentContext.init(option.role, option.agentIp, Integer.valueOf(agentPort), option.agentServer, option.dorisHomeDir, agentInstallDir);
-
String role = AgentRole.queryRole();
AgentContext.setRole(Role.findByName(role));
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommandController.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommandController.java
index 368f95e..7f72e50 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommandController.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommandController.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.api;
import org.apache.doris.manager.agent.command.CommandFactory;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommonControllder.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommonControllder.java
index da6a843..bdf5566 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommonControllder.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/api/CommonControllder.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.api;
import org.apache.doris.manager.agent.register.AgentContext;
@@ -23,7 +24,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-
@RestController
@RequestMapping("/common")
public class CommonControllder {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeCommand.java
index ee28f5b..195207f 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.exception.AgentException;
@@ -26,8 +27,8 @@ import java.util.Objects;
public abstract class BeCommand extends ListenerCommand {
@Override
public void beforeExecute(CommandType commandType) {
- if (Objects.isNull(AgentContext.getServiceInstallDir()) || Objects.isNull(AgentContext.getRole()) ||
- AgentContext.getRole() != Role.BE) {
+ if (Objects.isNull(AgentContext.getServiceInstallDir()) || Objects.isNull(AgentContext.getRole())
+ || AgentContext.getRole() != Role.BE) {
throw new AgentException("service be not installed");
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallCommand.java
index 2a582dd..0b3f967 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java
index c6a1c9a..0b9421c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.task.ScriptTaskDesc;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskHook.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskHook.java
index 33f874e..eb45546 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskHook.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskHook.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.common.AgentConstants;
@@ -49,4 +50,4 @@ public class BeInstallTaskHook extends TaskHook<BeInstallTaskDesc> {
AgentContext.setHealthCheckPort(AgentConstants.BE_HTTP_PORT_DEFAULT);
}
}
-}
\ No newline at end of file
+}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStartCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStartCommand.java
index 8996cb6..1a0873b 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStartCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStartCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStopCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStopCommand.java
index baa93e1..2752fa5 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStopCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeStopCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
@@ -25,7 +26,6 @@ import org.apache.doris.manager.agent.task.Task;
import org.apache.doris.manager.agent.task.TaskHandlerFactory;
import org.apache.doris.manager.common.domain.CommandType;
-
public class BeStopCommand extends BeCommand {
@Override
public Task setupTask() {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/Command.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/Command.java
index e89c04a..1debb53 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/Command.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/Command.java
@@ -14,19 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.task.ITaskHandlerFactory;
import org.apache.doris.manager.agent.task.Task;
import org.apache.doris.manager.common.domain.CommandType;
-
public abstract class Command {
private Task task;
private ITaskHandlerFactory handlerFactory;
protected CommandType commandType;
-
public Command setup() {
task = setupTask();
commandType = setupCommandType();
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandFactory.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandFactory.java
index e42bb27..899885d 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandFactory.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandFactory.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import com.alibaba.fastjson.JSON;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java
index 9a1dce1..51aa07c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.common.domain.CommandType;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResult.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResult.java
index 3575b24..7431854 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResult.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResult.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.task.TaskResult;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResultService.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResultService.java
index 451df4b..94ae2d7 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResultService.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandResultService.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.common.AgentConstants;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeCommand.java
index f25fdd9..b86b8e0 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.exception.AgentException;
@@ -26,8 +27,8 @@ import java.util.Objects;
public abstract class FeCommand extends ListenerCommand {
@Override
public void beforeExecute(CommandType commandType) {
- if (Objects.isNull(AgentContext.getServiceInstallDir()) || Objects.isNull(AgentContext.getRole()) ||
- AgentContext.getRole() != Role.FE) {
+ if (Objects.isNull(AgentContext.getServiceInstallDir()) || Objects.isNull(AgentContext.getRole())
+ || AgentContext.getRole() != Role.FE) {
throw new AgentException("service fe not installed");
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallCommand.java
index 12dfb4d..f08d2f5 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskDesc.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskDesc.java
index 551462c..74c4546 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskDesc.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskDesc.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.task.ScriptTaskDesc;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskHook.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskHook.java
index d2a96ae..2d0e347 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskHook.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeInstallTaskHook.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.common.AgentConstants;
@@ -27,7 +28,6 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
-
public class FeInstallTaskHook extends TaskHook<FeInstallTaskDesc> {
@Override
public void onSuccess(FeInstallTaskDesc taskDesc) {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStartCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStartCommand.java
index f9eaf2a..568a20c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStartCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStartCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStopCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStopCommand.java
index d0c4126..930e677 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStopCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/FeStopCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.register.AgentContext;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/ListenerCommand.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/ListenerCommand.java
index d6fbade..ec712d1 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/ListenerCommand.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/ListenerCommand.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.command;
import org.apache.doris.manager.agent.task.Task;
@@ -24,4 +25,4 @@ public abstract class ListenerCommand extends Command implements CommandListener
beforeExecute(commandType);
return super.execute();
}
-}
\ No newline at end of file
+}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/AgentConstants.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/AgentConstants.java
index 716986f..74f8c59 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/AgentConstants.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/AgentConstants.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.common;
public class AgentConstants {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/PropertiesUtil.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/PropertiesUtil.java
index 62d1796..6ca37d1 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/PropertiesUtil.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/common/PropertiesUtil.java
@@ -14,10 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.common;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import lombok.extern.slf4j.Slf4j;
import java.io.BufferedReader;
import java.io.IOException;
@@ -25,9 +25,9 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
+@Slf4j
public class PropertiesUtil {
- private static final Logger log = LoggerFactory.getLogger(PropertiesUtil.class);
private static final String DEFAULT_PROPERTIES = "/application.properties";
/**
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
index b68714d..6012028 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.exception;
public class AgentException extends RuntimeException {
@@ -21,7 +22,6 @@ public class AgentException extends RuntimeException {
private static final Integer DEAFULT_EXCEPTION_STATUS = 500;
private int status;
-
public AgentException(String message) {
this(message, DEAFULT_EXCEPTION_STATUS);
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/GlobalExceptionHandler.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/GlobalExceptionHandler.java
index b641d8c..05089f0 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/GlobalExceptionHandler.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/GlobalExceptionHandler.java
@@ -14,19 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.exception;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
+@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
- private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
-
@ExceptionHandler(AgentException.class)
public RResult handleException(AgentException exception) {
log.error(exception.getMessage(), exception);
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentContext.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentContext.java
index d090509..3d34bb9 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentContext.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentContext.java
@@ -14,8 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.register;
+package org.apache.doris.manager.agent.register;
import org.apache.doris.manager.common.domain.Role;
import org.apache.logging.log4j.util.Strings;
@@ -60,7 +60,6 @@ public class AgentContext {
}
}
-
public static String getBashBin() {
return bashBin;
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentHeartbeat.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentHeartbeat.java
index 97ca69d..b7d068a 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentHeartbeat.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentHeartbeat.java
@@ -14,11 +14,11 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
@@ -26,14 +26,15 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+@Slf4j
public class AgentHeartbeat extends BaseRequest {
- private static final Logger log = LoggerFactory.getLogger(AgentHeartbeat.class);
- private static final long HEARTBEAT_TIME = 10000l;
- private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+ private static final long HEARTBEAT_TIME = 10000L;
+
+ private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);
public static void start() {
- scheduler.scheduleWithFixedDelay(() -> {
+ SCHEDULER.scheduleWithFixedDelay(() -> {
if (!heartbeat()) {
log.error("agent heartbeat fail!");
} else {
@@ -49,9 +50,9 @@ public class AgentHeartbeat extends BaseRequest {
map.put("port", AgentContext.getAgentPort());
RResult res = null;
- try{
+ try {
res = sendRequest(requestUrl, map);
- }catch (Exception ex){
+ } catch (Exception ex) {
return false;
}
if (res.getCode() == 0) {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRegister.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRegister.java
index e6a32c4..4e1885a 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRegister.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRegister.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import org.apache.doris.manager.common.domain.RResult;
@@ -31,9 +32,9 @@ public class AgentRegister extends BaseRequest {
map.put("port", AgentContext.getAgentPort());
RResult res = null;
- try{
+ try {
res = sendRequest(requestUrl, map);
- }catch (Exception ex){
+ } catch (Exception ex) {
return false;
}
if (res.getCode() == 0) {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRole.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRole.java
index 46f8d5f..2bb2b11 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRole.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/AgentRole.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import org.apache.doris.manager.common.domain.RResult;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/ApplicationOption.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/ApplicationOption.java
index e39ebf6..b9d6fdb 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/ApplicationOption.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/ApplicationOption.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import org.kohsuke.args4j.Option;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BaseRequest.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BaseRequest.java
index 3601cec..274c94b 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BaseRequest.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BaseRequest.java
@@ -14,9 +14,11 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -25,24 +27,22 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Map;
+@Slf4j
public class BaseRequest {
- private static final Logger log = LoggerFactory.getLogger(BaseRequest.class);
-
public static RResult sendRequest(String requestUrl, Map<String, Object> params) {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
- RequestConfig requestConfig = RequestConfig.custom().
- setConnectTimeout(5000).
- setConnectionRequestTimeout(5000)
- .setSocketTimeout(5000).build();
+ RequestConfig requestConfig = RequestConfig.custom()
+ .setConnectTimeout(5000)
+ .setConnectionRequestTimeout(5000)
+ .setSocketTimeout(5000)
+ .build();
httpPost.setConfig(requestConfig);
httpPost.setEntity(new StringEntity(JSON.toJSONString(params), "utf-8"));
@@ -55,7 +55,7 @@ public class BaseRequest {
response = httpclient.execute(httpPost);
result = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
- log.error("request url error:{},param:{}",requestUrl,params,e);
+ log.error("request url error:{},param:{}", requestUrl, params, e);
throw new RuntimeException(e);
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BeState.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BeState.java
index cadb973..5e74b5e 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BeState.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/BeState.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import com.alibaba.fastjson.JSON;
@@ -35,10 +36,11 @@ public class BeState {
HttpGet httpget = new HttpGet(requestUrl);
- RequestConfig requestConfig = RequestConfig.custom().
- setConnectTimeout(5000).
- setConnectionRequestTimeout(5000)
- .setSocketTimeout(5000).build();
+ RequestConfig requestConfig = RequestConfig.custom()
+ .setConnectTimeout(5000)
+ .setConnectionRequestTimeout(5000)
+ .setSocketTimeout(5000)
+ .build();
httpget.setConfig(requestConfig);
CloseableHttpResponse response = null;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/FeState.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/FeState.java
index 3a1b23f..6c3e655 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/FeState.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/FeState.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import com.alibaba.fastjson.JSON;
@@ -35,10 +36,11 @@ public class FeState {
HttpGet httpget = new HttpGet(requestUrl);
- RequestConfig requestConfig = RequestConfig.custom().
- setConnectTimeout(5000).
- setConnectionRequestTimeout(5000)
- .setSocketTimeout(5000).build();
+ RequestConfig requestConfig = RequestConfig.custom()
+ .setConnectTimeout(5000)
+ .setConnectionRequestTimeout(5000)
+ .setSocketTimeout(5000)
+ .build();
httpget.setConfig(requestConfig);
CloseableHttpResponse response = null;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/StateService.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/StateService.java
index 2f9002e..d4cc402 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/StateService.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/register/StateService.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.register;
import org.apache.doris.manager.common.domain.Role;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java
index 9303ca3..e1df06f 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.concurrent.ExecutorService;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskHandlerFactory.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskHandlerFactory.java
index 7913676..5f77a00 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskHandlerFactory.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskHandlerFactory.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public interface ITaskHandlerFactory {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java
index d5dd206..65cb9de 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import javafx.util.Pair;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/LRU.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/LRU.java
index e81d737..2ee44f0 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/LRU.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/LRU.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.LinkedHashMap;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandler.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandler.java
index 3fcebdf..8452f8a 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandler.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandler.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.concurrent.ExecutorService;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandlerFactory.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandlerFactory.java
index 9246302..5ed2283 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandlerFactory.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/QueuedTaskHandlerFactory.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public class QueuedTaskHandlerFactory implements ITaskHandlerFactory {
@@ -23,8 +24,9 @@ public class QueuedTaskHandlerFactory implements ITaskHandlerFactory {
public TaskHandler createTaskHandler() {
if (instance == null) {
synchronized (QueuedTaskHandlerFactory.class) {
- if (instance == null)
+ if (instance == null) {
instance = new QueuedTaskHandler();
+ }
}
}
return instance;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTask.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTask.java
index 41c6803..f15a4a3 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTask.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTask.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.io.BufferedReader;
@@ -37,7 +38,6 @@ public class ScriptTask extends Task<ScriptTaskDesc> {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
-
String s = null;
while ((s = stdInput.readLine()) != null) {
getTasklog().appendStdLog(s);
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java
index b10a877..261ddd1 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public class ScriptTaskDesc extends TaskDesc {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
index 69aaa26..522fba5 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public class SyncTaskHandler extends TaskHandler {
@@ -22,4 +23,5 @@ public class SyncTaskHandler extends TaskHandler {
public void doHandle(Task task) {
task.executeTask();
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandlerFactory.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandlerFactory.java
index 2db5a13..984f208 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandlerFactory.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandlerFactory.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public class SyncTaskHandlerFactory implements ITaskHandlerFactory {
@@ -23,8 +24,9 @@ public class SyncTaskHandlerFactory implements ITaskHandlerFactory {
public TaskHandler createTaskHandler() {
if (instance == null) {
synchronized (SyncTaskHandlerFactory.class) {
- if (instance == null)
+ if (instance == null) {
instance = new SyncTaskHandler();
+ }
}
}
return instance;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/Task.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/Task.java
index 884317a..a31b2d6 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/Task.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/Task.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.Date;
@@ -21,10 +22,12 @@ import java.util.UUID;
public abstract class Task<T extends TaskDesc> {
protected T taskDesc;
+
private TaskResult taskResult;
+
private ITaskLog tasklog;
- private TaskHook taskHook;
+ private TaskHook taskHook;
private Task(T taskDesc) {
this.taskDesc = taskDesc;
@@ -43,7 +46,6 @@ public abstract class Task<T extends TaskDesc> {
this.taskHook = taskHook;
}
-
public ITaskLog getTasklog() {
return tasklog;
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskContext.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskContext.java
index 967ab6a..39b302c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskContext.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskContext.java
@@ -14,22 +14,23 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import org.apache.doris.manager.agent.common.AgentConstants;
public class TaskContext {
- private static final LRU<String, Task> taskLRU = new LRU<>(AgentConstants.COMMAND_HISTORY_SAVE_MAX_COUNT);
+ private static final LRU<String, Task> TAST_LRU = new LRU<>(AgentConstants.COMMAND_HISTORY_SAVE_MAX_COUNT);
public static synchronized void register(Task task) {
- taskLRU.put(task.getTaskId(), task);
+ TAST_LRU.put(task.getTaskId(), task);
}
public static synchronized void unregister(Task task) {
- taskLRU.remove(task.getTaskId());
+ TAST_LRU.remove(task.getTaskId());
}
public static synchronized Task getTaskByTaskId(String taskId) {
- return taskLRU.get(taskId);
+ return TAST_LRU.get(taskId);
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java
index 5700811..3d9dbe3 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public abstract class TaskDesc {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskExecutorService.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskExecutorService.java
index 8afb633..0f27c16 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskExecutorService.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskExecutorService.java
@@ -14,13 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TaskExecutorService {
- private static final ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
+ private static ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
public static ExecutorService getSingleThreadExecutor() {
return singleThreadExecutor;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
index 6488f61..0e23d50 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.Date;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandlerFactory.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandlerFactory.java
index eba7df4..2dfd564 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandlerFactory.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandlerFactory.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import org.apache.doris.manager.agent.exception.AgentException;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHook.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHook.java
index ccae3a5..1fa882b 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHook.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHook.java
@@ -1,3 +1,20 @@
+// 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
+//
+// http://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.
+
package org.apache.doris.manager.agent.task;
public abstract class TaskHook<T extends TaskDesc> {
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskLruLog.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskLruLog.java
index d4478d0..edc770c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskLruLog.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskLruLog.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import org.apache.doris.manager.agent.common.AgentConstants;
@@ -29,7 +30,6 @@ public class TaskLruLog implements ITaskLog {
private int currentStdPage = 0;
private int currentErrPage = 0;
-
public TaskLruLog() {
this(AgentConstants.TASK_LOG_ROW_MAX_COUNT, AgentConstants.TASK_LOG_ROW_MAX_COUNT);
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskResult.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskResult.java
index a4138e8..2c73ca3 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskResult.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskResult.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
import java.util.Date;
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskState.java b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskState.java
index 1fbb71b..198a2b4 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskState.java
+++ b/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskState.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.agent.task;
public enum TaskState {
diff --git a/manager/dm-agent/src/main/resources/application.properties b/manager/dm-agent/src/main/resources/application.properties
index 542e0e3..ee817a8 100644
--- a/manager/dm-agent/src/main/resources/application.properties
+++ b/manager/dm-agent/src/main/resources/application.properties
@@ -1 +1 @@
-server.port=9602
\ No newline at end of file
+server.port=9602
diff --git a/manager/dm-agent/src/main/resources/logback-spring.xml b/manager/dm-agent/src/main/resources/logback-spring.xml
index 22cd80a..b826595 100644
--- a/manager/dm-agent/src/main/resources/logback-spring.xml
+++ b/manager/dm-agent/src/main/resources/logback-spring.xml
@@ -1,4 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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
+ http://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.
+-->
+
<configuration debug="false">
<springProperty scope="context" name="springAppName" source="spring.application.name" defaultValue="agent" />
<property name="LOG_HOME" value="./log"/>
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/BeInstallCommandRequestBody.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/BeInstallCommandRequestBody.java
index 662c67c..2843c51 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/BeInstallCommandRequestBody.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/BeInstallCommandRequestBody.java
@@ -14,13 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public class BeInstallCommandRequestBody {
private String installDir;
+
private String packageUrl;
- private boolean mkBeStorageDir = false;
+ private boolean mkBeStorageDir = false;
public boolean isMkBeStorageDir() {
return mkBeStorageDir;
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandRequest.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandRequest.java
index 999990e..78a652e 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandRequest.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandRequest.java
@@ -14,10 +14,12 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public class CommandRequest {
private String commandType;
+
private String body;
public String getCommandType() {
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandType.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandType.java
index 25738bd..102d486 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandType.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/CommandType.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public enum CommandType {
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeInstallCommandRequestBody.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeInstallCommandRequestBody.java
index 0a68d62..fbad2a3 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeInstallCommandRequestBody.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeInstallCommandRequestBody.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public class FeInstallCommandRequestBody {
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeStartCommandRequestBody.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeStartCommandRequestBody.java
index 894c7e3..550afce 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeStartCommandRequestBody.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/FeStartCommandRequestBody.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public class FeStartCommandRequestBody {
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/RResult.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/RResult.java
index 3818543..cca5630 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/RResult.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/RResult.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
import java.util.HashMap;
diff --git a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/Role.java b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/Role.java
index 683d7ac..342aa12 100644
--- a/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/Role.java
+++ b/manager/dm-common/src/main/java/org/apache/doris/manager/common/domain/Role.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.doris.manager.common.domain;
public enum Role {
diff --git a/manager/dm-server/pom.xml b/manager/dm-server/pom.xml
index cda05a9..d3b259c 100644
--- a/manager/dm-server/pom.xml
+++ b/manager/dm-server/pom.xml
@@ -18,26 +18,21 @@
<java.version>1.8</java.version>
</properties>
<dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.springframework.boot</groupId>-->
+<!-- <artifactId>spring-boot-starter-web</artifactId>-->
+<!-- </dependency>-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.springframework.boot</groupId>-->
+<!-- <artifactId>spring-boot-starter-test</artifactId>-->
+<!-- <scope>test</scope>-->
+<!-- </dependency>-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
- </dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.springframework.boot</groupId>-->
+<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
+<!-- </dependency>-->
<dependency>
<groupId>org.apache.doris</groupId>
@@ -59,11 +54,6 @@
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.76</version>
- </dependency>
</dependencies>
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/impl/ServerDaoImpl.java b/manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/impl/ServerDaoImpl.java
deleted file mode 100644
index c916eb1..0000000
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/impl/ServerDaoImpl.java
+++ /dev/null
@@ -1,160 +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
-//
-// http://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.
-package org.apache.doris.manager.server.dao.impl;
-
-import org.apache.doris.manager.server.constants.AgentStatus;
-import org.apache.doris.manager.server.dao.ServerDao;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.entity.AgentRoleEntity;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.BatchPreparedStatementSetter;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Repository;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-/**
- * server dao
- **/
-@Repository
-public class ServerDaoImpl implements ServerDao {
-
- @Autowired
- private JdbcTemplate jdbcTemplate;
-
- @Override
- public List<AgentEntity> queryAgentNodes(List<String> hosts) {
- String sql = "select id,host,port,status,register_time,last_reported_time" +
- " from t_agent ";
- if (hosts != null && !hosts.isEmpty()) {
- sql = sql + " where host in (%s)";
- String inSql = String.join(",", Collections.nCopies(hosts.size(), "?"));
- sql = String.format(sql, inSql);
- }
- List<AgentEntity> agentEntities = jdbcTemplate.query(
- sql, (resultSet, i) -> {
- Integer id = resultSet.getInt("id");
- String ht = resultSet.getString("host");
- Integer pt = resultSet.getInt("port");
- String status = resultSet.getString("status");
- Date registerTime = resultSet.getTimestamp("register_time");
- Date lastReportedTime = resultSet.getTimestamp("last_reported_time");
- return new AgentEntity(id, ht, pt, status, registerTime, lastReportedTime);
- }, hosts.toArray());
- return agentEntities;
- }
-
- @Override
- public AgentEntity agentInfo(String host, Integer port) {
- String sql = "select id,host,port,status,register_time,last_reported_time from t_agent where host = ? and port = ?";
- List<AgentEntity> agents = jdbcTemplate.query(sql, (resultSet, i) -> {
- Integer id = resultSet.getInt("id");
- String ht = resultSet.getString("host");
- Integer pt = resultSet.getInt("port");
- String status = resultSet.getString("status");
- Date registerTime = resultSet.getTimestamp("register_time");
- Date lastReportedTime = resultSet.getTimestamp("last_reported_time");
- return new AgentEntity(id, ht, pt, status, registerTime, lastReportedTime);
- }, host, port);
- if (agents != null && !agents.isEmpty()) {
- return agents.get(0);
- }
- return null;
- }
-
- @Override
- public int refreshAgentStatus(String host, Integer port) {
- String sql = "update t_agent set last_reported_time = now(),status = ? where host = ? and port = ?";
- return jdbcTemplate.update(sql, AgentStatus.RUNNING.name(), host, port);
- }
-
- @Override
- public int registerAgent(String host, Integer port) {
- String sql = "insert into t_agent(host,port,status,register_time) values(?,?,?,now())";
- return jdbcTemplate.update(sql, host, port, AgentStatus.RUNNING.name());
- }
-
- @Override
- public int updateBatchAgentStatus(List<AgentEntity> agents) {
- String sql = "update t_agent set status = ? where id = ?";
- int[] i = jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
- public void setValues(PreparedStatement ps, int i) throws SQLException {
- AgentEntity agent = agents.get(i);
- ps.setString(1, agent.getStatus());
- ps.setInt(2, agent.getId());
- }
-
- public int getBatchSize() {
- return agents.size();
- }
- });
- return i.length;
- }
-
- @Override
- public int insertAgentRole(List<AgentRoleEntity> agentRoles) {
- String sql = "insert into t_agent_role(host,role,install_dir) values(?,?,?)";
- int[] i = jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
- public void setValues(PreparedStatement ps, int i) throws SQLException {
- AgentRoleEntity node = agentRoles.get(i);
- ps.setString(1, node.getHost());
- ps.setString(2, node.getRole());
- ps.setString(3, node.getInstallDir());
- }
-
- public int getBatchSize() {
- return agentRoles.size();
- }
- });
- return i.length;
- }
-
- @Override
- public String agentRole(String host) {
- String sql = "select host,role,install_dir from t_agent_role where host = ?";
- List<AgentRoleEntity> agentRoles = jdbcTemplate.query(sql, (resultSet, i) -> {
- String ht = resultSet.getString("host");
- String role = resultSet.getString("role");
- String installDir = resultSet.getString("install_dir");
- return new AgentRoleEntity(ht, role, installDir);
- }, host);
- if (agentRoles != null && !agentRoles.isEmpty()) {
- return agentRoles.get(0).getRole();
- }
- return null;
- }
-
- @Override
- public List<AgentRoleEntity> agentRoles() {
- String sql = "select host,role,install_dir from t_agent_role";
- List<AgentRoleEntity> agentRoles = jdbcTemplate.query(sql, (resultSet, i) -> {
- String ht = resultSet.getString("host");
- String role = resultSet.getString("role");
- String installDir = resultSet.getString("install_dir");
- return new AgentRoleEntity(ht, role, installDir);
- });
- if (agentRoles == null) {
- return new ArrayList<>();
- }
- return agentRoles;
- }
-}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentEntity.java b/manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentEntity.java
deleted file mode 100644
index 1e7c86a..0000000
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentEntity.java
+++ /dev/null
@@ -1,103 +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
-//
-// http://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.
-package org.apache.doris.manager.server.entity;
-
-import java.util.Date;
-
-/**
- * agent entity
- **/
-public class AgentEntity {
-
- private Integer id;
-
- private String host;
-
- private Integer port;
-
- private String status;
-
- private Date registerTime;
-
- private Date lastReportedTime;
-
- public AgentEntity() {
- }
-
- public AgentEntity(Integer id, String host, Integer port, String status, Date registerTime, Date lastReportedTime) {
- this.id = id;
- this.host = host;
- this.port = port;
- this.status = status;
- this.registerTime = registerTime;
- this.lastReportedTime = lastReportedTime;
- }
-
- public AgentEntity(String host, Integer port, String status) {
- this.host = host;
- this.port = port;
- this.status = status;
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public Integer getPort() {
- return port;
- }
-
- public void setPort(Integer port) {
- this.port = port;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Date getRegisterTime() {
- return registerTime;
- }
-
- public void setRegisterTime(Date registerTime) {
- this.registerTime = registerTime;
- }
-
- public Date getLastReportedTime() {
- return lastReportedTime;
- }
-
- public void setLastReportedTime(Date lastReportedTime) {
- this.lastReportedTime = lastReportedTime;
- }
-}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/DmServerApplication.java b/manager/dm-server/src/main/java/org/apache/doris/stack/DmServerApplication.java
similarity index 96%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/DmServerApplication.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/DmServerApplication.java
index af7801a..80a5cb3 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/DmServerApplication.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/DmServerApplication.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server;
+
+package org.apache.doris.stack;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentCache.java b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentCache.java
similarity index 79%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentCache.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentCache.java
index b83e88b..97b7c04 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentCache.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentCache.java
@@ -14,15 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.agent;
-import org.apache.doris.manager.server.dao.ServerDao;
-import org.apache.doris.manager.server.entity.AgentEntity;
+package org.apache.doris.stack.agent;
+
+import com.google.common.collect.Lists;
+import org.apache.doris.stack.component.AgentComponent;
+import org.apache.doris.stack.entity.AgentEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -34,10 +35,10 @@ import java.util.stream.Collectors;
@Component
public class AgentCache {
- private static final Map<String, AgentEntity> hostAgentCache = new ConcurrentHashMap<>();
+ private static Map<String, AgentEntity> hostAgentCache = new ConcurrentHashMap<>();
@Autowired
- private ServerDao serverDao;
+ private AgentComponent agentComponent;
@PostConstruct
public void init() {
@@ -45,7 +46,7 @@ public class AgentCache {
}
private void loadAgents() {
- List<AgentEntity> agentEntities = serverDao.queryAgentNodes(new ArrayList<>());
+ List<AgentEntity> agentEntities = agentComponent.queryAgentNodes(Lists.newArrayList());
if (agentEntities != null && !agentEntities.isEmpty()) {
Map<String, AgentEntity> agentsMap = agentEntities.stream().collect(Collectors.toMap(AgentEntity::getHost, v -> v));
hostAgentCache.putAll(agentsMap);
@@ -63,6 +64,6 @@ public class AgentCache {
* put agent to cache
*/
public void putAgent(AgentEntity agent) {
- hostAgentCache.put(agent.getHost(),agent);
+ hostAgentCache.put(agent.getHost(), agent);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentHeatbeatRunner.java b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentHeatbeatRunner.java
similarity index 69%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentHeatbeatRunner.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentHeatbeatRunner.java
index 9808ab4..196b74c 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentHeatbeatRunner.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentHeatbeatRunner.java
@@ -14,19 +14,19 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.agent;
-import org.apache.doris.manager.server.constants.AgentStatus;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.service.ServerProcess;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.doris.stack.agent;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.doris.stack.constants.AgentStatus;
+import org.apache.doris.stack.dao.AgentRepository;
+import org.apache.doris.stack.entity.AgentEntity;
+import org.apache.doris.stack.service.ServerProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Executors;
@@ -37,15 +37,18 @@ import java.util.concurrent.TimeUnit;
* agent status check
**/
@Component
+@Slf4j
public class AgentHeatbeatRunner implements ApplicationRunner {
- private static final Logger log = LoggerFactory.getLogger(AgentHeatbeatRunner.class);
- private static final long HEALTH_TIME = 60 * 1000l;
- private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+ private static final long HEALTH_TIME = 60 * 1000L;
+ private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
@Autowired
private ServerProcess serverProcess;
+ @Autowired
+ private AgentRepository agentRepository;
+
@Override
public void run(ApplicationArguments args) throws Exception {
this.scheduler.scheduleWithFixedDelay(() -> {
@@ -53,6 +56,7 @@ public class AgentHeatbeatRunner implements ApplicationRunner {
heartbeatCheck();
} catch (Exception ex) {
log.error("heartbeat check fail:", ex);
+ ex.printStackTrace();
}
}, 0, HEALTH_TIME, TimeUnit.MILLISECONDS);
}
@@ -62,24 +66,18 @@ public class AgentHeatbeatRunner implements ApplicationRunner {
*/
private void heartbeatCheck() {
long currTime = System.currentTimeMillis();
- List<AgentEntity> unHealthAgent = new ArrayList<>();
List<AgentEntity> agents = serverProcess.agentList();
for (AgentEntity agent : agents) {
Date lastReportedTime = agent.getLastReportedTime();
long diff = HEALTH_TIME + 1;
- if(lastReportedTime != null){
+ if (lastReportedTime != null) {
diff = currTime - lastReportedTime.getTime();
}
if (diff > HEALTH_TIME) {
- AgentEntity agentEntity = new AgentEntity();
- agentEntity.setId(agent.getId());
- agentEntity.setStatus(AgentStatus.STOP.name());
- unHealthAgent.add(agentEntity);
+ agent.setStatus(AgentStatus.STOP.name());
+ agentRepository.save(agent);
log.warn("agent {} is unhealthly", agent.getHost());
}
}
- if (!unHealthAgent.isEmpty()) {
- serverProcess.updateBatchAgentStatus(unHealthAgent);
- }
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentRest.java b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentRest.java
similarity index 98%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentRest.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentRest.java
index 2043bb8..e2defc5 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/agent/AgentRest.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/agent/AgentRest.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.agent;
+
+package org.apache.doris.stack.agent;
import org.apache.doris.manager.common.domain.RResult;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/stack/component/AgentComponent.java b/manager/dm-server/src/main/java/org/apache/doris/stack/component/AgentComponent.java
new file mode 100644
index 0000000..ccf4b53
--- /dev/null
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/component/AgentComponent.java
@@ -0,0 +1,73 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.doris.stack.constants.AgentStatus;
+import org.apache.doris.stack.dao.AgentRepository;
+import org.apache.doris.stack.dao.AgentRoleRepository;
+import org.apache.doris.stack.entity.AgentEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+
+@Component
+@Slf4j
+public class AgentComponent {
+
+ @Autowired
+ private AgentRepository agentRepository;
+
+ @Autowired
+ private AgentRoleRepository agentRoleRepository;
+
+ public List<AgentEntity> queryAgentNodes(List<String> hosts) {
+ if (hosts == null || hosts.isEmpty()) {
+ return agentRepository.findAll();
+ }
+ return agentRepository.queryAgentNodes(hosts);
+ }
+
+ public AgentEntity agentInfo(String host, Integer port) {
+ List<AgentEntity> agentEntities = agentRepository.agentInfo(host, port);
+ if (agentEntities != null && !agentEntities.isEmpty()) {
+ return agentEntities.get(0);
+ } else {
+ return null;
+ }
+ }
+
+ public int refreshAgentStatus(String host, Integer port) {
+ AgentEntity agentInfo = agentInfo(host, port);
+ if (agentInfo == null) {
+ return 0;
+ }
+ agentInfo.setStatus(AgentStatus.RUNNING.name());
+ agentInfo.setLastReportedTime(new Date());
+ agentRepository.save(agentInfo);
+ return 1;
+ }
+
+ public AgentEntity registerAgent(String host, Integer port) {
+ AgentEntity agentEntity = new AgentEntity(host, port, AgentStatus.RUNNING.name());
+ return agentRepository.save(agentEntity);
+ }
+
+}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/config/RestTemplateConfig.java b/manager/dm-server/src/main/java/org/apache/doris/stack/config/RestTemplateConfig.java
similarity index 95%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/config/RestTemplateConfig.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/config/RestTemplateConfig.java
index c6e82fa..eebdd21 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/config/RestTemplateConfig.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/config/RestTemplateConfig.java
@@ -14,13 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.config;
+
+package org.apache.doris.stack.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
-
@Configuration
public class RestTemplateConfig {
@Bean
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/AgentStatus.java b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/AgentStatus.java
similarity index 94%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/AgentStatus.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/constants/AgentStatus.java
index 8da4e9e..ab8948d 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/AgentStatus.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/AgentStatus.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.constants;
+
+package org.apache.doris.stack.constants;
public enum AgentStatus {
RUNNING,
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/CmdTypeEnum.java b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/CmdTypeEnum.java
similarity index 95%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/CmdTypeEnum.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/constants/CmdTypeEnum.java
index 49d7c9b..c75b18d 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/CmdTypeEnum.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/CmdTypeEnum.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.constants;
+
+package org.apache.doris.stack.constants;
public enum CmdTypeEnum {
START,
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/Constants.java b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/Constants.java
similarity index 73%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/Constants.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/constants/Constants.java
index eabfc8f..ce534b8 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/constants/Constants.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/constants/Constants.java
@@ -14,11 +14,12 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.constants;
+
+package org.apache.doris.stack.constants;
public class Constants {
- public static String KEY_SERVER_PORT = "server.port";
- public static String KEY_DORIS_AGENT_INSTALL_DIR = "doris.manager.agent.install.dir";
- public static String KEY_DORIS_AGENT_START_SCRIPT = "doris.manager.agent.start-script";
+ public static final String KEY_SERVER_PORT = "server.port";
+ public static final String KEY_DORIS_AGENT_INSTALL_DIR = "doris.manager.agent.install.dir";
+ public static final String KEY_DORIS_AGENT_START_SCRIPT = "doris.manager.agent.start-script";
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/AgentController.java b/manager/dm-server/src/main/java/org/apache/doris/stack/controller/AgentController.java
similarity index 87%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/AgentController.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/controller/AgentController.java
index b182cc7..bc189bd 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/AgentController.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/controller/AgentController.java
@@ -14,21 +14,23 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.controller;
+package org.apache.doris.stack.controller;
+
+import io.swagger.annotations.Api;
import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.model.req.DorisExecReq;
-import org.apache.doris.manager.server.model.req.DorisInstallReq;
-import org.apache.doris.manager.server.model.req.TaskInfoReq;
-import org.apache.doris.manager.server.model.req.TaskLogReq;
-import org.apache.doris.manager.server.service.ServerAgent;
+import org.apache.doris.stack.req.DorisExecReq;
+import org.apache.doris.stack.req.DorisInstallReq;
+import org.apache.doris.stack.req.TaskInfoReq;
+import org.apache.doris.stack.req.TaskLogReq;
+import org.apache.doris.stack.service.ServerAgent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-
+@Api(tags = "Agent API")
@RestController
@RequestMapping("/agent")
public class AgentController {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/ServerController.java b/manager/dm-server/src/main/java/org/apache/doris/stack/controller/ServerController.java
similarity index 86%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/ServerController.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/controller/ServerController.java
index 7a542c7..de76fe8 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/controller/ServerController.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/controller/ServerController.java
@@ -14,15 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.controller;
+package org.apache.doris.stack.controller;
+
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.model.req.AgentCommon;
-import org.apache.doris.manager.server.model.req.SshInfo;
-import org.apache.doris.manager.server.service.ServerProcess;
-import org.apache.doris.manager.server.util.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.doris.stack.req.AgentCommon;
+import org.apache.doris.stack.req.SshInfo;
+import org.apache.doris.stack.service.ServerProcess;
+import org.apache.doris.stack.util.Preconditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,12 +32,12 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
+@Api(tags = "Server API")
@RestController
@RequestMapping("/server")
+@Slf4j
public class ServerController {
- private static final Logger log = LoggerFactory.getLogger(ServerController.class);
-
@Autowired
private ServerProcess serverProcess;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java b/manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRepository.java
similarity index 51%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRepository.java
index e8fc9b1..0fcc6da 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRepository.java
@@ -14,40 +14,29 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.service;
-import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.model.req.SshInfo;
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.AgentEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
import java.util.List;
/**
- * server
+ * Copyright (C) 2020 Baidu, Inc. All Rights Reserved.
+ *
+ * @Author: songchuanyuan@baidu.com
+ * @Description:
+ * @Date: 2021/8/18
*/
-public interface ServerProcess {
-
-
- void initAgent(SshInfo sshInfo);
-
- /**
- * install agent
- */
- void startAgent(SshInfo sshInfo);
-
- /**
- * agent list
- */
- List<AgentEntity> agentList();
-
- /**
- * update agent status batch
- */
- int updateBatchAgentStatus(List<AgentEntity> agents);
+public interface AgentRepository extends JpaRepository<AgentEntity, Integer> {
- String agentRole(String host);
+ @Query("select f from AgentEntity f where f.host in (:hosts)")
+ List<AgentEntity> queryAgentNodes(@Param("hosts") List<String> hosts);
- void heartbeat(String host, Integer port);
+ @Query("select f from AgentEntity f where f.host = :host and f.port = :port")
+ List<AgentEntity> agentInfo(@Param("host")String host, @Param("port")Integer port);
- RResult register(String host, Integer port);
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRoleRepository.java
similarity index 68%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRoleRepository.java
index 6488f61..342a201 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/dao/AgentRoleRepository.java
@@ -14,16 +14,19 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.dao;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+import org.apache.doris.stack.entity.AgentRoleEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
- public abstract void doHandle(Task task);
+/**
+ * Copyright (C) 2020 Baidu, Inc. All Rights Reserved.
+ *
+ * @Author: songchuanyuan@baidu.com
+ * @Description:
+ * @Date: 2021/8/18
+ */
+public interface AgentRoleRepository extends JpaRepository<AgentRoleEntity, String> {
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java b/manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentEntity.java
similarity index 50%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentEntity.java
index b5942f2..da99892 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentEntity.java
@@ -14,27 +14,51 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class AgentCommon {
+package org.apache.doris.stack.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+/**
+ * agent entity
+ **/
+@Entity
+@Table(name = "t_agent")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class AgentEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
private String host;
private Integer port;
- public String getHost() {
- return host;
- }
+ private String status;
- public void setHost(String host) {
- this.host = host;
- }
+ @Column(name = "register_time")
+ private Date registerTime;
- public Integer getPort() {
- return port;
- }
+ @Column(name = "last_reported_time")
+ private Date lastReportedTime;
- public void setPort(Integer port) {
+ public AgentEntity(String host, Integer port, String status) {
+ this.host = host;
this.port = port;
+ this.status = status;
+ this.registerTime = new Date();
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java b/manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentRoleEntity.java
similarity index 63%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentRoleEntity.java
index c6a1c9a..989e26f 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/BeInstallTaskDesc.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/entity/AgentRoleEntity.java
@@ -14,18 +14,32 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.command;
-import org.apache.doris.manager.agent.task.ScriptTaskDesc;
+package org.apache.doris.stack.entity;
-public class BeInstallTaskDesc extends ScriptTaskDesc {
- private String installDir;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "t_agent_role")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class AgentRoleEntity {
- public String getInstallDir() {
- return installDir;
- }
+ @Id
+ @Column(length = 150)
+ private String host;
+
+ private String role;
+
+ @Column(name = "install_dir")
+ private String installDir;
- public void setInstallDir(String installDir) {
- this.installDir = installDir;
- }
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/GlobalExceptionHandler.java b/manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/GlobalExceptionHandler.java
similarity index 88%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/GlobalExceptionHandler.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/GlobalExceptionHandler.java
index 3a2657a..8cd402c 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/GlobalExceptionHandler.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/GlobalExceptionHandler.java
@@ -14,19 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.exceptions;
+package org.apache.doris.stack.exceptions;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
+@Slf4j
public class GlobalExceptionHandler {
- private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
-
@ExceptionHandler(ServerException.class)
public RResult handleException(ServerException exception) {
log.error(exception.getMessage(), exception);
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/ServerException.java b/manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/ServerException.java
similarity index 92%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/ServerException.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/ServerException.java
index fa84864..6042ca5 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/exceptions/ServerException.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/exceptions/ServerException.java
@@ -14,13 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.exceptions;
+
+package org.apache.doris.stack.exceptions;
public class ServerException extends RuntimeException {
- private static final long serialVersionUID = -1L;
+ private static final long SERIAL_VERSION_UID = -1L;
+
private static final Integer DEAFULT_EXCEPTION_STATUS = 500;
- private int status;
+ private int status;
public ServerException(String message) {
this(message, DEAFULT_EXCEPTION_STATUS);
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/AgentCommon.java
similarity index 95%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/req/AgentCommon.java
index b5942f2..410af84 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/AgentCommon.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
public class AgentCommon {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExec.java
similarity index 96%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExec.java
index 15cbd85..7075b8b 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExec.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
public class DorisExec {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExecReq.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExecReq.java
similarity index 96%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExecReq.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExecReq.java
index 1d08ba3..d289a3b 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExecReq.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisExecReq.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
import java.util.List;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisInstallReq.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisInstallReq.java
similarity index 95%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisInstallReq.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisInstallReq.java
index fcf0167..8d505b6 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisInstallReq.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/DorisInstallReq.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
import java.util.List;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/InstallInfo.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/InstallInfo.java
similarity index 97%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/InstallInfo.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/req/InstallInfo.java
index 4ea611f..49c3b05 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/InstallInfo.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/InstallInfo.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
public class InstallInfo {
//host
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/SshInfo.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/SshInfo.java
similarity index 96%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/SshInfo.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/req/SshInfo.java
index 8c805c1..dbf29c1 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/SshInfo.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/SshInfo.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
import java.util.List;
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskInfoReq.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskInfoReq.java
similarity index 95%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskInfoReq.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskInfoReq.java
index ca31b11..06c6fc9 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskInfoReq.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskInfoReq.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
+
+package org.apache.doris.stack.req;
public class TaskInfoReq {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskLogReq.java
similarity index 90%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskLogReq.java
index 91b63e6..da44425 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/req/TaskLogReq.java
@@ -14,9 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
+package org.apache.doris.stack.req;
+
+public class TaskLogReq extends TaskInfoReq {
private int offset;
public int getOffset() {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerAgent.java b/manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerAgent.java
similarity index 81%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerAgent.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerAgent.java
index 3ba41c6..3594cc6 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerAgent.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerAgent.java
@@ -14,17 +14,17 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.service;
+
+package org.apache.doris.stack.service;
import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.model.req.DorisExecReq;
-import org.apache.doris.manager.server.model.req.DorisInstallReq;
-import org.apache.doris.manager.server.model.req.TaskInfoReq;
-import org.apache.doris.manager.server.model.req.TaskLogReq;
+import org.apache.doris.stack.req.DorisExecReq;
+import org.apache.doris.stack.req.DorisInstallReq;
+import org.apache.doris.stack.req.TaskInfoReq;
+import org.apache.doris.stack.req.TaskLogReq;
import java.util.List;
-
/**
* server agent
**/
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java b/manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerProcess.java
similarity index 82%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java
copy to manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerProcess.java
index e8fc9b1..872624e 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/ServerProcess.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/service/ServerProcess.java
@@ -14,11 +14,12 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.service;
+
+package org.apache.doris.stack.service;
import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.model.req.SshInfo;
+import org.apache.doris.stack.entity.AgentEntity;
+import org.apache.doris.stack.req.SshInfo;
import java.util.List;
@@ -27,7 +28,6 @@ import java.util.List;
*/
public interface ServerProcess {
-
void initAgent(SshInfo sshInfo);
/**
@@ -40,11 +40,6 @@ public interface ServerProcess {
*/
List<AgentEntity> agentList();
- /**
- * update agent status batch
- */
- int updateBatchAgentStatus(List<AgentEntity> agents);
-
String agentRole(String host);
void heartbeat(String host, Integer port);
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerAgentImpl.java b/manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerAgentImpl.java
similarity index 81%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerAgentImpl.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerAgentImpl.java
index 515547e..831fc2d 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerAgentImpl.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerAgentImpl.java
@@ -14,9 +14,11 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.service.impl;
+
+package org.apache.doris.stack.service.impl;
import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.BeInstallCommandRequestBody;
import org.apache.doris.manager.common.domain.CommandRequest;
import org.apache.doris.manager.common.domain.CommandType;
@@ -24,25 +26,24 @@ import org.apache.doris.manager.common.domain.FeInstallCommandRequestBody;
import org.apache.doris.manager.common.domain.FeStartCommandRequestBody;
import org.apache.doris.manager.common.domain.RResult;
import org.apache.doris.manager.common.domain.Role;
-import org.apache.doris.manager.server.agent.AgentCache;
-import org.apache.doris.manager.server.agent.AgentRest;
-import org.apache.doris.manager.server.constants.CmdTypeEnum;
-import org.apache.doris.manager.server.dao.ServerDao;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.entity.AgentRoleEntity;
-import org.apache.doris.manager.server.exceptions.ServerException;
-import org.apache.doris.manager.server.model.req.DorisExec;
-import org.apache.doris.manager.server.model.req.DorisExecReq;
-import org.apache.doris.manager.server.model.req.DorisInstallReq;
-import org.apache.doris.manager.server.model.req.InstallInfo;
-import org.apache.doris.manager.server.model.req.TaskInfoReq;
-import org.apache.doris.manager.server.model.req.TaskLogReq;
-import org.apache.doris.manager.server.service.ServerAgent;
-import org.apache.doris.manager.server.util.Preconditions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.doris.stack.agent.AgentCache;
+import org.apache.doris.stack.agent.AgentRest;
+import org.apache.doris.stack.constants.CmdTypeEnum;
+import org.apache.doris.stack.dao.AgentRoleRepository;
+import org.apache.doris.stack.entity.AgentEntity;
+import org.apache.doris.stack.entity.AgentRoleEntity;
+import org.apache.doris.stack.exceptions.ServerException;
+import org.apache.doris.stack.req.DorisExec;
+import org.apache.doris.stack.req.DorisExecReq;
+import org.apache.doris.stack.req.DorisInstallReq;
+import org.apache.doris.stack.req.InstallInfo;
+import org.apache.doris.stack.req.TaskInfoReq;
+import org.apache.doris.stack.req.TaskLogReq;
+import org.apache.doris.stack.service.ServerAgent;
+import org.apache.doris.stack.util.Preconditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
@@ -50,32 +51,30 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-
/**
* server agent
**/
@Service
+@Slf4j
public class ServerAgentImpl implements ServerAgent {
- private static final Logger log = LoggerFactory.getLogger(ServerAgentImpl.class);
-
- @Autowired
- private ServerDao serverDao;
-
@Autowired
private AgentRest agentRest;
@Autowired
private AgentCache agentCache;
+ @Autowired
+ private AgentRoleRepository roleRepository;
+
@Override
+ @Transactional
public List<Object> install(DorisInstallReq installReq) {
- List<String> agentRoleList = serverDao.agentRoles().stream()
+ List<String> agentRoleList = roleRepository.findAll().stream()
.map(m -> (m.getHost() + "-" + m.getRole()))
.collect(Collectors.toList());
List<Object> results = new ArrayList<>();
List<InstallInfo> installInfos = installReq.getInstallInfos();
- List<AgentRoleEntity> agentRoles = new ArrayList<>();
for (InstallInfo install : installInfos) {
String key = install.getHost() + "-" + install.getRole();
if (agentRoleList.contains(key)) {
@@ -83,11 +82,10 @@ public class ServerAgentImpl implements ServerAgent {
continue;
}
RResult result = installDoris(install);
- agentRoles.add(new AgentRoleEntity(install.getHost(), install.getRole(), install.getInstallDir()));
+ roleRepository.save(new AgentRoleEntity(install.getHost(), install.getRole(), install.getInstallDir()));
+
results.add(result.getData());
}
- //save agent role
- serverDao.insertAgentRole(agentRoles);
return results;
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerProcessImpl.java b/manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerProcessImpl.java
similarity index 78%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerProcessImpl.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerProcessImpl.java
index a2ea855..ac33c7c 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/service/impl/ServerProcessImpl.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/service/impl/ServerProcessImpl.java
@@ -14,23 +14,29 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.service.impl;
+package org.apache.doris.stack.service.impl;
+
+import static org.apache.doris.stack.constants.Constants.KEY_DORIS_AGENT_INSTALL_DIR;
+import static org.apache.doris.stack.constants.Constants.KEY_DORIS_AGENT_START_SCRIPT;
+import static org.apache.doris.stack.constants.Constants.KEY_SERVER_PORT;
+
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
import org.apache.doris.manager.common.domain.RResult;
-import org.apache.doris.manager.server.agent.AgentCache;
-import org.apache.doris.manager.server.constants.AgentStatus;
-import org.apache.doris.manager.server.dao.ServerDao;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.exceptions.ServerException;
-import org.apache.doris.manager.server.model.req.SshInfo;
-import org.apache.doris.manager.server.service.ServerProcess;
-import org.apache.doris.manager.server.shell.SCP;
-import org.apache.doris.manager.server.shell.SSH;
-import org.apache.doris.manager.server.util.Preconditions;
-import org.apache.doris.manager.server.util.PropertiesUtil;
+import org.apache.doris.stack.agent.AgentCache;
+import org.apache.doris.stack.component.AgentComponent;
+import org.apache.doris.stack.dao.AgentRoleRepository;
+import org.apache.doris.stack.entity.AgentEntity;
+import org.apache.doris.stack.entity.AgentRoleEntity;
+import org.apache.doris.stack.exceptions.ServerException;
+import org.apache.doris.stack.req.SshInfo;
+import org.apache.doris.stack.service.ServerProcess;
+import org.apache.doris.stack.shell.SCP;
+import org.apache.doris.stack.shell.SSH;
+import org.apache.doris.stack.util.Preconditions;
+import org.apache.doris.stack.util.PropertiesUtil;
import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.stereotype.Service;
@@ -43,31 +49,30 @@ import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
-import static org.apache.doris.manager.server.constants.Constants.KEY_DORIS_AGENT_INSTALL_DIR;
-import static org.apache.doris.manager.server.constants.Constants.KEY_DORIS_AGENT_START_SCRIPT;
-import static org.apache.doris.manager.server.constants.Constants.KEY_SERVER_PORT;
-
/**
* server
**/
@Service
+@Slf4j
public class ServerProcessImpl implements ServerProcess {
- private static final Logger log = LoggerFactory.getLogger(ServerProcessImpl.class);
private static final String AGENT_INSTALL_DIR = PropertiesUtil.getPropValue(KEY_DORIS_AGENT_INSTALL_DIR);
private static final String AGENT_START_SCRIPT = PropertiesUtil.getPropValue(KEY_DORIS_AGENT_START_SCRIPT);
@Autowired
- private ServerDao serverDao;
+ private AgentComponent agentComponent;
@Autowired
private AgentCache agentCache;
+ @Autowired
+ private AgentRoleRepository roleRepository;
+
@Override
public void initAgent(SshInfo sshInfo) {
ApplicationHome applicationHome = new ApplicationHome(ServerProcessImpl.class);
@@ -100,33 +105,34 @@ public class ServerProcessImpl implements ServerProcess {
@Override
public List<AgentEntity> agentList() {
- List<AgentEntity> agentEntities = serverDao.queryAgentNodes(new ArrayList<>());
+ List<AgentEntity> agentEntities = agentComponent.queryAgentNodes(Lists.newArrayList());
return agentEntities;
}
@Override
- public int updateBatchAgentStatus(List<AgentEntity> agents) {
- return serverDao.updateBatchAgentStatus(agents);
- }
-
- @Override
public String agentRole(String host) {
- return serverDao.agentRole(host);
+ Optional<AgentRoleEntity> agentRoleOp = roleRepository.findById(host);
+ if (agentRoleOp.equals(Optional.empty())) {
+ return null;
+ }
+ return agentRoleOp.get().getRole();
+
}
@Override
public void heartbeat(String host, Integer port) {
- serverDao.refreshAgentStatus(host, port);
+ agentComponent.refreshAgentStatus(host, port);
}
@Override
public RResult register(String host, Integer port) {
- AgentEntity agentEntity = serverDao.agentInfo(host, port);
+ AgentEntity agentEntity = agentComponent.agentInfo(host, port);
+
if (agentEntity != null) {
return RResult.success("agent already register");
}
- serverDao.registerAgent(host, port);
- agentCache.putAgent(new AgentEntity(host, port, AgentStatus.RUNNING.name()));
+ AgentEntity newAgentEntity = agentComponent.registerAgent(host, port);
+ agentCache.putAgent(newAgentEntity);
return RResult.success("agent register success");
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/BaseCommand.java b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/BaseCommand.java
similarity index 90%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/BaseCommand.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/shell/BaseCommand.java
index 53d15d9..33e60a4 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/BaseCommand.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/BaseCommand.java
@@ -14,11 +14,11 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.shell;
+package org.apache.doris.stack.shell;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
@@ -28,10 +28,9 @@ import java.util.stream.Collectors;
/**
* base command
**/
+@Slf4j
public abstract class BaseCommand {
- private static final Logger log = LoggerFactory.getLogger(BaseCommand.class);
-
protected String[] resultCommand;
protected Long timeout = 10000L;
@@ -73,13 +72,18 @@ public abstract class BaseCommand {
process.exitValue();
return true;
} catch (IllegalThreadStateException ignored) {
+ log.error("process exception");
+ ignored.printStackTrace();
}
// Check if process has terminated once per second
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
+ e.printStackTrace();
}
- } while (System.currentTimeMillis() - startTime < timeout);
+ }
+ while (System.currentTimeMillis() - startTime < timeout);
+
return false;
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SCP.java b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/SCP.java
similarity index 97%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SCP.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/shell/SCP.java
index 815746e..0b907bd 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SCP.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/SCP.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.shell;
+
+package org.apache.doris.stack.shell;
/**
* scp
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SSH.java b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/SSH.java
similarity index 97%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SSH.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/shell/SSH.java
index e132c91..c0e7e18 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/shell/SSH.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/shell/SSH.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.shell;
+
+package org.apache.doris.stack.shell;
/**
* ssh
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/util/Preconditions.java b/manager/dm-server/src/main/java/org/apache/doris/stack/util/Preconditions.java
similarity index 97%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/util/Preconditions.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/util/Preconditions.java
index c45ae9f..ea9cf89 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/util/Preconditions.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/util/Preconditions.java
@@ -14,7 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.util;
+
+package org.apache.doris.stack.util;
public class Preconditions {
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/util/PropertiesUtil.java b/manager/dm-server/src/main/java/org/apache/doris/stack/util/PropertiesUtil.java
similarity index 89%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/util/PropertiesUtil.java
rename to manager/dm-server/src/main/java/org/apache/doris/stack/util/PropertiesUtil.java
index 2dd1741..4d3a02d 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/util/PropertiesUtil.java
+++ b/manager/dm-server/src/main/java/org/apache/doris/stack/util/PropertiesUtil.java
@@ -14,10 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.util;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.doris.stack.util;
+
+import lombok.extern.slf4j.Slf4j;
import java.io.BufferedReader;
import java.io.IOException;
@@ -25,9 +25,9 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
+@Slf4j
public class PropertiesUtil {
- private static final Logger log = LoggerFactory.getLogger(PropertiesUtil.class);
private static final String DEFAULT_PROPERTIES = "/application.properties";
/**
diff --git a/manager/dm-server/src/main/resources/application.properties b/manager/dm-server/src/main/resources/application.properties
index a34d7cc..d6324e5 100644
--- a/manager/dm-server/src/main/resources/application.properties
+++ b/manager/dm-server/src/main/resources/application.properties
@@ -1,15 +1,8 @@
-server.port=9601
-
-spring.datasource.url = jdbc:mysql://localhost:3306/doris_manager?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
-spring.datasource.username = root
-spring.datasource.password = password
-
-doris.manager.agent.install.dir = /usr/local/doris-manager
-doris.manager.agent.start-script = agent/bin/agent_start.sh
-
-
-
-
-
-
-
+#server.port=9601
+#
+#spring.datasource.url = jdbc:mysql://localhost:port/test3?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+#spring.datasource.username = root
+#spring.datasource.password = 123456
+#
+#doris.manager.agent.install.dir = /usr/local/doris-manager
+#doris.manager.agent.start-script = agent/bin/agent_start.sh
diff --git a/manager/dm-server/src/main/resources/logback-spring.xml b/manager/dm-server/src/main/resources/logback-spring.xml
index e437501..da22f83 100644
--- a/manager/dm-server/src/main/resources/logback-spring.xml
+++ b/manager/dm-server/src/main/resources/logback-spring.xml
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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
+ http://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.
+-->
<configuration debug="false">
<springProperty scope="context" name="springAppName" source="spring.application.name" defaultValue="server" />
<property name="LOG_HOME" value="./log"/>
diff --git "a/manager/doc/Doris Manager Server \346\216\245\345\217\243\346\226\207\346\241\243.md" "b/manager/doc/Doris Manager Server \346\216\245\345\217\243\346\226\207\346\241\243.md"
index aeccad3..555fe38 100644
--- "a/manager/doc/Doris Manager Server \346\216\245\345\217\243\346\226\207\346\241\243.md"
+++ "b/manager/doc/Doris Manager Server \346\216\245\345\217\243\346\226\207\346\241\243.md"
@@ -1,6 +1,11 @@
[TOC]
---
+## Doris Manager API文档
+
+### Doris Manager 接口文档
+
+Direct access after local service startup:http://localhost:port/swagger-ui.html#/
### Doris Manager Server 接口文档
@@ -483,4 +488,5 @@
]
}
}
-```
\ No newline at end of file
+```
+
diff --git "a/manager/doc/Doris Manager Server\347\274\226\350\257\221\345\222\214\351\203\250\347\275\262\346\226\207\346\241\243.md" "b/manager/doc/Doris Manager Server\347\274\226\350\257\221\345\222\214\351\203\250\347\275\262\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..6588f50
--- /dev/null
+++ "b/manager/doc/Doris Manager Server\347\274\226\350\257\221\345\222\214\351\203\250\347\275\262\346\226\207\346\241\243.md"
@@ -0,0 +1,52 @@
+## Doris Manager 编译部署文档
+
+### 编译
+直接运行manager路径下的build.sh脚本,会在manager路径下生成安装运行包——output,包中包括:
+1、Doris Manager的运行包doris-manager.jar
+2、运行的配置文件夹conf
+3、启动脚本start_manager.sh
+4、停止脚本stop_manager.sh
+
+### 运行
+#### 1 配置
+进入生成的安装运行包,查看配置文件conf路径,打开路径中的配置文件manager.conf,重点关注的配置项内容如下:
+```$xslt
+服务的启动http端口
+STUDIO_PORT=8080
+
+后端数据存放的数据库的类型,包括mysql/h2/postgresql.默认是支持mysql
+MB_DB_TYPE=mysql
+
+数据库连接信息
+如果是配置的h2类型数据库,就不需要配置这些信息,会把数据以本地文件存放在本地
+如果是mysql/postgresql就需要配置如下连接信息
+数据库地址
+MB_DB_HOST=
+
+数据库端口
+MB_DB_PORT=3306
+
+数据库访问端口
+MB_DB_USER=
+数据库访问密码
+MB_DB_PASS=123456
+
+数据库的database名称
+MB_DB_DBNAME
+```
+
+#### 2 启动
+配置修改完成后,回到安装运行包,直接运行如下命令
+```$xslt
+nohup sh ./start_manager.sh > start.log 2>&1 &
+```
+查看logs中的日志即可判断程序是否启动成功
+
+#### 3 使用
+预设了一个超级管理员用户,信息如下:
+```$xslt
+用户名: Admin
+密码: Admin@123
+(大小写敏感)
+```
+为了确保使用安全,登陆后请修改密码!
\ No newline at end of file
diff --git a/manager/general/pom.xml b/manager/general/pom.xml
new file mode 100644
index 0000000..18400ee
--- /dev/null
+++ b/manager/general/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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
+ http://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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.doris</groupId>
+ <artifactId>doris-manager</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>general</artifactId>
+
+ <dependencies>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/ClusterUserComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/ClusterUserComponent.java
new file mode 100644
index 0000000..b7582b8
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/ClusterUserComponent.java
@@ -0,0 +1,183 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import org.apache.doris.stack.constant.ConstantDef;
+import org.apache.doris.stack.model.request.user.UserGroupRole;
+import org.apache.doris.stack.dao.ClusterInfoRepository;
+import org.apache.doris.stack.dao.CoreUserRepository;
+import org.apache.doris.stack.dao.PermissionsGroupMembershipRepository;
+import org.apache.doris.stack.dao.PermissionsGroupRoleRepository;
+import org.apache.doris.stack.entity.ClusterInfoEntity;
+import org.apache.doris.stack.entity.CoreUserEntity;
+import org.apache.doris.stack.entity.PermissionsGroupMembershipEntity;
+import org.apache.doris.stack.entity.PermissionsGroupRoleEntity;
+import org.apache.doris.stack.exception.NoPermissionException;
+import org.apache.doris.stack.model.response.user.GroupMember;
+import org.apache.doris.stack.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:The engine cluster management tool class is mainly responsible for
+ * verifying whether the user has the permission of cluster space
+ * TODO:The current user can only be in one user space
+ */
+@Component
+@Slf4j
+public class ClusterUserComponent extends BaseService {
+
+ @Autowired
+ private ClusterInfoRepository clusterInfoRepository;
+
+ @Autowired
+ private PermissionsGroupRoleRepository groupRoleRepository;
+
+ @Autowired
+ private PermissionsGroupMembershipRepository membershipRepository;
+
+ @Autowired
+ private CoreUserRepository userRepository;
+
+ /**
+ * Find the corresponding spatial information according to the user information
+ *
+ * @param userId
+ * @return
+ * @throws Exception
+ */
+ public ClusterInfoEntity getClusterByUserId(int userId) throws Exception {
+ int clusterId = getClusterIdByUserId(userId);
+ if (clusterId == ConstantDef.NON_CLUSTER) {
+ log.error("User not belong to any cluster space, please assign it first.");
+ throw new NoPermissionException();
+ }
+ ClusterInfoEntity clusterInfo = clusterInfoRepository.findById(clusterId).get();
+ log.debug("The user {} cluster is {}.", userId, clusterId);
+ return clusterInfo;
+ }
+
+ /**
+ * Judge whether the user is a user in the space
+ *
+ * @param userId
+ * @return
+ * @throws Exception
+ */
+ public boolean checkUserBelongToCluster(int userId, int clusterId) throws Exception {
+ int userClusterId = getClusterIdByUserId(userId);
+ if (userClusterId != clusterId) {
+ log.error("The user {} is not a space {} user.", userId, clusterId);
+ throw new NoPermissionException();
+ }
+ return true;
+ }
+
+ /**
+ * Check whether the space administrator and the user requesting the operation are the same user space
+ *
+ * @param requestId
+ * @param userId
+ * @return
+ */
+ public int checkUserSameCluster(int requestId, int userId) throws Exception {
+ int requestClusterId = getClusterIdByUserId(requestId);
+ int clusterId = getClusterIdByUserId(userId);
+
+ if (requestClusterId != clusterId) {
+ log.error("The users cluster id not same.");
+ throw new NoPermissionException();
+ }
+ return clusterId;
+ }
+
+ public int getClusterIdByUserId(int userId) throws Exception {
+ log.debug("Get user {} palo cluster id.", userId);
+ List<PermissionsGroupMembershipEntity> memberships = membershipRepository.getByUserId(userId);
+ if (memberships == null || memberships.size() == 0) {
+ log.error("The user {} no have group.", userId);
+ throw new NoPermissionException();
+ }
+
+ int groupId = memberships.get(0).getGroupId();
+
+ PermissionsGroupRoleEntity groupRoleEntity = groupRoleRepository.findById(groupId).get();
+
+ return groupRoleEntity.getClusterId();
+ }
+
+ /**
+ * Initialize the correspondence between permission groups and users
+ *
+ * @param userId
+ * @param groupId
+ * @return
+ */
+ public int addGroupUserMembership(int userId, int groupId) {
+ PermissionsGroupMembershipEntity amdinMembershipEntity =
+ new PermissionsGroupMembershipEntity(userId, groupId);
+ return membershipRepository.save(amdinMembershipEntity).getId();
+ }
+
+ /**
+ * Create a user group and return the user group ID
+ *
+ * @return
+ */
+ public int addPermissionsGroup(String name, int clusterId, UserGroupRole role) {
+ // Create a user group and bind the relationship with the Doris cluster and user information.
+ PermissionsGroupRoleEntity groupRoleEntity =
+ new PermissionsGroupRoleEntity(name, role.name(), clusterId);
+ int groupId = groupRoleRepository.save(groupRoleEntity).getGroupId();
+ log.debug("create group {}.", groupId);
+
+ return groupId;
+ }
+
+ /**
+ * Get all members of a permission group
+ *
+ * @param groupId
+ * @return
+ */
+ public List<GroupMember> getGroupMembers(int groupId) {
+ log.debug("get group {} all members.", groupId);
+ List<PermissionsGroupMembershipEntity> users = membershipRepository.getByGroupId(groupId);
+
+ List<GroupMember> members = new ArrayList<>();
+ for (PermissionsGroupMembershipEntity membershipEntity : users) {
+ // get user
+ CoreUserEntity userEntity = userRepository.findById(membershipEntity.getUserId()).get();
+
+ // construct Member
+ GroupMember member = new GroupMember();
+ member.setMembershipId(membershipEntity.getId());
+ member.setUserId(membershipEntity.getUserId());
+ member.setName(userEntity.getFirstName());
+ member.setEmail(userEntity.getEmail());
+
+ // add list
+ members.add(member);
+ }
+ return members;
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/IdaasComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/IdaasComponent.java
new file mode 100644
index 0000000..a20c84b
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/IdaasComponent.java
@@ -0,0 +1,160 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import org.apache.doris.stack.model.request.config.InitStudioReq;
+import org.apache.doris.stack.model.request.config.IdaasSettingReq;
+import org.apache.doris.stack.model.response.config.IdaasResult;
+import org.apache.doris.stack.model.response.config.IdaasSettingResp;
+import org.apache.doris.stack.entity.SettingEntity;
+import org.apache.doris.stack.service.config.ConfigConstant;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import java.util.Map;
+
+@Component
+@Slf4j
+public class IdaasComponent {
+
+ @Autowired
+ private SettingComponent settingComponent;
+
+ private final Base64.Encoder encoder = Base64.getEncoder();
+ public boolean checkIdaasConnection(IdaasSettingReq idaasSettingReq) throws Exception {
+ try {
+ getAccessToken(idaasSettingReq);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ public ResponseEntity<IdaasResult> getAccessToken(IdaasSettingReq idaasSettingReq) throws Exception {
+ String getAccessTokenURL =
+ idaasSettingReq.getIdaasProjectURL() + "/app/oauth/" + idaasSettingReq.getIdaasAppId() + "/token";
+ RestTemplate restTemplate = new RestTemplate();
+ // Set request parameters form-data
+ MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
+ map.add("grant_type", "client_credentials");
+ map.add("scope", "admin");
+ HttpHeaders headers = new HttpHeaders();
+ // Set authentication string
+ String basicAuth = encoder.encodeToString((idaasSettingReq.getIdaasClientId() + ":" + idaasSettingReq.getIdaasClientSecret()).getBytes(
+ StandardCharsets.UTF_8));
+ log.debug("idaas base64 is {}.", basicAuth);
+ headers.setBasicAuth(basicAuth);
+ headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
+ ResponseEntity<IdaasResult> responseEntity = restTemplate.postForEntity(getAccessTokenURL, request,
+ IdaasResult.class);
+ return responseEntity;
+ }
+
+ public void addIdaasConfig(IdaasSettingReq idaasSettingReq, Map<String, String> configCache) throws Exception {
+ settingComponent.addNewSetting(ConfigConstant.IDAAS_PROJECT_URL_KEY, idaasSettingReq.getIdaasProjectURL(),
+ configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.IDAAS_APP_ID_KEY, idaasSettingReq.getIdaasAppId(),
+ configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.IDAAS_PROJECT_ID_KEY, idaasSettingReq.getIdaasProjectId(),
+ configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.IDAAS_CLIENT_ID_KEY, idaasSettingReq.getIdaasClientId(),
+ configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.IDAAS_CLIENT_SECRET_KEY, idaasSettingReq.getIdaasClientSecret(),
+ configCache);
+ }
+
+ /**
+ * Is Idaas authentication enabled
+ *
+ * @return
+ */
+ public boolean enabled() {
+ SettingEntity entity = settingComponent.readSetting(ConfigConstant.AUTH_TYPE_KEY);
+
+ if (entity == null) {
+ log.debug("The idaas is not enabled");
+ return false;
+ } else if (entity.getValue().equals(InitStudioReq.AuthType.idaas.name())) {
+ log.debug("The idaas is enabled");
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * get Idaas Configuration item
+ *
+ * @return
+ */
+ public IdaasSettingResp readIdaasConfig() {
+ IdaasSettingResp idaasSettingResp = new IdaasSettingResp();
+
+ if (!enabled()) {
+ log.warn("Idaas configuration don't exist.");
+ idaasSettingResp.setIdaasEnabled(false);
+ return idaasSettingResp;
+ }
+
+ idaasSettingResp.setIdaasEnabled(true);
+
+ SettingEntity idaasProjectURL = settingComponent.readSetting(ConfigConstant.IDAAS_PROJECT_URL_KEY);
+ if (idaasProjectURL != null) {
+ idaasSettingResp.setIdaasProjectURL(idaasProjectURL.getValue());
+ }
+
+ SettingEntity idaasProjectId = settingComponent.readSetting(ConfigConstant.IDAAS_PROJECT_ID_KEY);
+ if (idaasProjectId != null) {
+ idaasSettingResp.setIdaasProjectId(idaasProjectId.getValue());
+ }
+
+ SettingEntity idaasAppId = settingComponent.readSetting(ConfigConstant.IDAAS_APP_ID_KEY);
+ if (idaasAppId != null) {
+ idaasSettingResp.setIdaasAppId(idaasAppId.getValue());
+ }
+
+ SettingEntity idaasClientId = settingComponent.readSetting(ConfigConstant.IDAAS_CLIENT_ID_KEY);
+ if (idaasClientId != null) {
+ idaasSettingResp.setIdaasClientId(idaasClientId.getValue());
+ }
+
+ SettingEntity idaasClientSecret = settingComponent.readSetting(ConfigConstant.IDAAS_CLIENT_SECRET_KEY);
+ if (idaasClientSecret != null) {
+ idaasSettingResp.setIdaasClientSecret(idaasClientSecret.getValue());
+ }
+
+ return idaasSettingResp;
+ }
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/LdapComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/LdapComponent.java
new file mode 100644
index 0000000..99715f6
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/LdapComponent.java
@@ -0,0 +1,269 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import org.apache.doris.stack.model.ldap.LdapConnectionInfo;
+import org.apache.doris.stack.model.ldap.LdapUserInfo;
+import org.apache.doris.stack.model.ldap.LdapUserInfoReq;
+import org.apache.doris.stack.model.request.config.InitStudioReq;
+import org.apache.doris.stack.model.request.config.LdapSettingReq;
+import org.apache.doris.stack.model.response.config.LdapSettingResp;
+import org.apache.doris.stack.connector.LdapClient;
+import org.apache.doris.stack.entity.SettingEntity;
+import org.apache.doris.stack.exception.UserLoginException;
+import org.apache.doris.stack.service.config.ConfigConstant;
+import com.unboundid.ldap.sdk.LDAPConnection;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+@Component
+@Slf4j
+public class LdapComponent {
+ private static final String USER_BASE_DIV = "&";
+
+ @Autowired
+ private SettingComponent settingComponent;
+
+ @Autowired
+ private LdapClient ldapClient;
+
+ public void addLdapConfig(LdapSettingReq ldapSettingReq, Map<String, String> configCache) throws Exception {
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_HOST_KEY, ldapSettingReq.getLdapHost(), configCache);
+
+ String portStr;
+ if (ldapSettingReq.getLdapPort() == null) {
+ portStr = LdapSettingReq.PORT;
+ } else {
+ portStr = ldapSettingReq.getLdapPort().toString();
+ }
+ settingComponent.addNewSetting(ConfigConstant.LDAP_PORT_KEY, portStr, configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_SECURITY_KEY, ldapSettingReq.getLdapSecurity(), configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_BIND_DN_KEY, ldapSettingReq.getLdapBindDn(), configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_PASSWORD_KEY, ldapSettingReq.getLdapPassword(), configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_USER_BASE_KEY,
+ String.join(USER_BASE_DIV, ldapSettingReq.getLdapUserBase()), configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_USER_FILTER_KEY, ldapSettingReq.getLdapUserFilter(), configCache);
+
+ // The default setting property is mail
+ String ldapAttributeEmailStr;
+ if (ldapSettingReq.getLdapAttributeEmail() == null) {
+ ldapAttributeEmailStr = LdapSettingReq.MAIL;
+ } else {
+ ldapAttributeEmailStr = ldapSettingReq.getLdapAttributeEmail();
+ }
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_ATTRIBUTE_EMAIL_KEY, ldapAttributeEmailStr, configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_ATTRIBUTE_FIRSTNAME_KEY, ldapSettingReq.getLdapAttributeFirstName(), configCache);
+
+ settingComponent.addNewSetting(ConfigConstant.LDAP_ATTRIBUTE_LASTNAME_KEY, ldapSettingReq.getLdapAttributeLastName(), configCache);
+ }
+
+ /**
+ * Is LDAP authentication enabled
+ *
+ * @return
+ */
+ public boolean enabled() {
+ SettingEntity entity = settingComponent.readSetting(ConfigConstant.AUTH_TYPE_KEY);
+
+ if (entity == null) {
+ log.debug("The ldap is not enabled");
+ return false;
+ } else if (entity.getValue().equals(InitStudioReq.AuthType.ldap.name())) {
+ log.debug("The ldap is enabled");
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * get LDAP Configuration item
+ *
+ * @return
+ */
+ public LdapSettingResp readLdapConfig() {
+ LdapSettingResp ldapSettingResp = new LdapSettingResp();
+
+ if (!enabled()) {
+ log.warn("Ldap configuration don't exist.");
+ ldapSettingResp.setLdapEnabled(false);
+ return ldapSettingResp;
+ }
+
+ ldapSettingResp.setLdapEnabled(true);
+
+ SettingEntity ldapHost = settingComponent.readSetting(ConfigConstant.LDAP_HOST_KEY);
+ if (ldapHost != null) {
+ ldapSettingResp.setLdapHost(ldapHost.getValue());
+ }
+
+ SettingEntity ldapPort = settingComponent.readSetting(ConfigConstant.LDAP_PORT_KEY);
+ if (ldapPort != null) {
+ ldapSettingResp.setLdapPort(Integer.parseInt(ldapPort.getValue()));
+ }
+
+ SettingEntity ldapSecurity = settingComponent.readSetting(ConfigConstant.LDAP_SECURITY_KEY);
+ if (ldapSecurity != null) {
+ ldapSettingResp.setLdapSecurity(ldapSecurity.getValue());
+ }
+
+ SettingEntity ldapBindDN = settingComponent.readSetting(ConfigConstant.LDAP_BIND_DN_KEY);
+ if (ldapBindDN != null) {
+ ldapSettingResp.setLdapBindDn(ldapBindDN.getValue());
+ }
+
+ SettingEntity ldapPassword = settingComponent.readSetting(ConfigConstant.LDAP_PASSWORD_KEY);
+ if (ldapPassword != null) {
+ ldapSettingResp.setLdapPassword(ldapPassword.getValue());
+ }
+
+ ldapSettingResp.setLdapUserBase(getBaseDn());
+
+ SettingEntity ldapUserFilter = settingComponent.readSetting(ConfigConstant.LDAP_USER_FILTER_KEY);
+ if (ldapUserFilter != null) {
+ ldapSettingResp.setLdapUserFilter(ldapUserFilter.getValue());
+ }
+
+ SettingEntity ldapAttributeEmail = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_EMAIL_KEY);
+ if (ldapAttributeEmail != null) {
+ ldapSettingResp.setLdapAttributeEmail(ldapAttributeEmail.getValue());
+ }
+
+ SettingEntity ldapAttributeFirstName = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_FIRSTNAME_KEY);
+ if (ldapAttributeFirstName != null) {
+ ldapSettingResp.setLdapAttributeFirstName(ldapAttributeFirstName.getValue());
+ }
+
+ SettingEntity ldapAttributeLastName = settingComponent.readSetting(ConfigConstant.LDAP_ATTRIBUTE_LASTNAME_KEY);
+ if (ldapAttributeLastName != null) {
+ ldapSettingResp.setLdapAttributeLastName(ldapAttributeLastName.getValue());
+ }
+
+ return ldapSettingResp;
+ }
+
+ /**
+ * get Base DN
+ *
+ * @return
+ */
+ public List<String> getBaseDn() {
+ SettingEntity userBases = settingComponent.readSetting(ConfigConstant.LDAP_USER_BASE_KEY);
+ if (userBases != null && userBases.getValue() != null) {
+ return Arrays.asList(userBases.getValue().split(USER_BASE_DIV));
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * get ldap Connected entity
+ *
+ * @return
+ */
+ public LdapConnectionInfo getConnInfo() {
+ LdapSettingResp resp = readLdapConfig();
+
+ LdapConnectionInfo ldapConnection = new LdapConnectionInfo();
+ ldapConnection.setHost(resp.getLdapHost());
+ ldapConnection.setPort(resp.getLdapPort());
+ ldapConnection.setBindDn(resp.getLdapBindDn());
+ ldapConnection.setPassword(resp.getLdapPassword());
+ ldapConnection.setAttributeEmail(resp.getLdapAttributeEmail());
+
+ return ldapConnection;
+ }
+
+ /**
+ * Encapsulate LDAP request information
+ *
+ * @param ldapSettingReq
+ * @return
+ */
+ public boolean checkLdapConnection(LdapSettingReq ldapSettingReq) {
+ log.debug("check ldap connection info by LdapSettingReq.");
+ LdapConnectionInfo ldapConnection = new LdapConnectionInfo();
+ ldapConnection.setHost(ldapSettingReq.getLdapHost());
+ if (ldapSettingReq.getLdapPort() == null) {
+ ldapConnection.setPort(Integer.valueOf(LdapSettingReq.PORT));
+ } else {
+ ldapConnection.setPort(ldapSettingReq.getLdapPort());
+ }
+ ldapConnection.setBindDn(ldapSettingReq.getLdapBindDn());
+ ldapConnection.setPassword(ldapSettingReq.getLdapPassword());
+ ldapConnection.setSecurity(ldapSettingReq.getLdapSecurity());
+ ldapConnection.setUserBase(ldapSettingReq.getLdapUserBase());
+ ldapConnection.setUserFilter(ldapSettingReq.getLdapUserFilter());
+ if (ldapSettingReq.getLdapAttributeEmail() == null) {
+ ldapConnection.setAttributeEmail(LdapSettingReq.MAIL);
+ } else {
+ ldapConnection.setAttributeEmail(ldapSettingReq.getLdapAttributeEmail());
+ }
+
+ ldapConnection.setAttributeFirstname(ldapSettingReq.getLdapAttributeFirstName());
+ ldapConnection.setAttributeLastname(ldapSettingReq.getLdapAttributeLastName());
+
+ if (ldapClient.getConnection(ldapConnection) == null) {
+ log.error("Ldap Connection info error, please check.");
+ return false;
+ }
+ log.debug("Ldap Connection success.");
+ return true;
+ }
+
+ /**
+ * Find users by mailbox ID
+ *
+ * @param email
+ * @return
+ */
+ public LdapUserInfo searchUserByEmail(String email) throws Exception {
+ // get LDAP connection
+ LdapConnectionInfo connectionInfo = getConnInfo();
+ LDAPConnection connection = ldapClient.getConnection(connectionInfo);
+
+ System.out.println(connection);
+
+ // LDAP request
+ LdapUserInfoReq userInfoReq = new LdapUserInfoReq();
+ userInfoReq.setBaseDn(getBaseDn());
+ userInfoReq.setUserAttribute(connectionInfo.getAttributeEmail());
+ userInfoReq.setUserValue(email);
+
+ // search user
+ LdapUserInfo ldapUser = ldapClient.getUser(connection, userInfoReq);
+ if (ldapUser.getExist()) {
+ return ldapUser;
+ }
+ log.error("Ldap User {} is not exist, please check and try again.", email);
+ throw new UserLoginException();
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/MailComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/MailComponent.java
new file mode 100644
index 0000000..4630ee6
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/MailComponent.java
@@ -0,0 +1,460 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import org.apache.doris.stack.model.request.config.EmailInfo;
+import org.apache.doris.stack.entity.CoreUserEntity;
+import org.apache.doris.stack.entity.SettingEntity;
+import org.apache.doris.stack.exception.EmailSendException;
+import org.apache.doris.stack.service.config.ConfigConstant;
+import com.github.mustachejava.DefaultMustacheFactory;
+import com.github.mustachejava.Mustache;
+import com.github.mustachejava.MustacheFactory;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeUtility;
+
+import java.io.StringWriter;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+@Slf4j
+public class MailComponent {
+
+ protected static final String LOG_URL = "http://static.metabase.com/logo.png";
+
+ @Autowired
+ protected SettingComponent settingComponent;
+
+ public void sendRestPasswordMail(String emailDest, String resetUrl, String hostName) {
+ try {
+ EmailInfo emailInfo = getEmailInfo();
+ if (emailInfo == null) {
+ log.warn("The email not config.");
+ return;
+ }
+
+ Session mailSession = getEmailSession(emailInfo);
+ if (mailSession == null) {
+ log.warn("send reset password fail,get session error.");
+ return;
+ }
+ Message message = new MimeMessage(mailSession);
+ message.setFrom(new InternetAddress(emailInfo.getFromAddress()));
+ message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(emailDest));
+
+ // TODO:The name is temporarily in Chinese
+ message.setSubject(MimeUtility.encodeText("[Doris Studio] 密码重置请求", "utf-8", null));
+
+ MustacheFactory mf = new DefaultMustacheFactory();
+ Mustache m = mf.compile("mail/password_reset.mustache");
+ MailComponent.ResetPassword resetPassword = new MailComponent.ResetPassword();
+ resetPassword.setHostname(hostName);
+
+ String siteUrl = settingComponent.readSetting(ConfigConstant.SITE_URL_KEY).getValue();
+ log.debug("Get site url {} of doris studio.", siteUrl);
+
+ resetPassword.setPasswordResetUrl(siteUrl + resetUrl);
+
+ StringWriter writer = new StringWriter();
+ m.execute(writer, resetPassword).flush();
+ String htmlBody = writer.toString();
+
+ message.setContent(htmlBody, "text/html;charset=utf-8");
+
+ log.debug("Send reset password email.");
+ // Send mail asynchronously
+ sendEmail(message);
+ } catch (Exception e) {
+ log.error("Send reset password error {}.", e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ public void sendInvitationMail(String emailDest, String invitorName, String joinUrl) {
+ try {
+ log.debug("Invitor {} send invitation mail to {}.", invitorName, emailDest);
+ log.debug("Join url is {}.", joinUrl);
+ EmailInfo emailInfo = getEmailInfo();
+ if (emailInfo == null) {
+ log.warn("The email not config.");
+ return;
+ }
+
+ Session mailSession = getEmailSession(emailInfo);
+ if (mailSession == null) {
+ log.warn("send invitation mail fail,get session error.");
+ return;
+ }
+ Message message = new MimeMessage(mailSession);
+ if (emailInfo.getFromAddress() == null) {
+ message.setFrom(new InternetAddress());
+ } else {
+ message.setFrom(new InternetAddress(emailInfo.getFromAddress()));
+ }
+ message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(emailDest));
+
+ // TODO:The name is temporarily in Chinese
+ message.setSubject(MimeUtility.encodeText("[Doris Studio] 新用户邀请", "utf-8", null));
+
+ MustacheFactory mf = new DefaultMustacheFactory();
+ Mustache m = mf.compile("mail/new_user_invite.mustache");
+
+ MailComponent.NewUserInvitation userInvitation = new MailComponent.NewUserInvitation();
+ userInvitation.setInvitorName(invitorName);
+
+ String siteUrl = settingComponent.readSetting(ConfigConstant.SITE_URL_KEY).getValue();
+
+ log.debug("Get site url {} of doris studio.", siteUrl);
+
+ userInvitation.setJoinUrl(siteUrl + joinUrl);
+
+ StringWriter writer = new StringWriter();
+ m.execute(writer, userInvitation).flush();
+ String htmlBody = writer.toString();
+
+ message.setContent(htmlBody, "text/html;charset=utf-8");
+
+ log.debug("Send invite email.");
+
+ sendEmail(message);
+ } catch (Exception e) {
+ log.error("Send reset password error {}.", e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ public void sendUserJoineNote(List<CoreUserEntity> activeAdminUsers, CoreUserEntity joinUser) {
+ try {
+ log.debug("send user join notification mail");
+ EmailInfo emailInfo = getEmailInfo();
+ if (emailInfo == null) {
+ log.warn("The email not config.");
+ return;
+ }
+
+ Session mailSession = getEmailSession(emailInfo);
+ if (mailSession == null) {
+ log.warn("send reset password fail,get session error.");
+ return;
+ }
+
+ String siteUrl = settingComponent.readSetting(ConfigConstant.SITE_URL_KEY).getValue();
+ log.debug("Get site url {} of doris studio.", siteUrl);
+ String joinedUserEidtUrl = siteUrl + "/admin/people";
+
+ for (CoreUserEntity adminUser : activeAdminUsers) {
+ log.debug("Send user joined notification email to admin user {}.", adminUser.getEmail());
+ Message message = new MimeMessage(mailSession);
+ if (emailInfo.getFromAddress() == null) {
+ message.setFrom(new InternetAddress());
+ } else {
+ message.setFrom(new InternetAddress(emailInfo.getFromAddress()));
+ }
+ message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(adminUser.getEmail()));
+
+ // TODO:The name is temporarily in Chinese
+ message.setSubject(MimeUtility.encodeText("[Doris Studio] 用户加入通知", "utf-8", null));
+ message.setSentDate(new Date());
+
+ MustacheFactory mf = new DefaultMustacheFactory();
+ Mustache m = mf.compile("mail/user_joined_notification.mustache");
+
+ MailComponent.UserJoinedNotice joinedNotice = new MailComponent.UserJoinedNotice();
+ joinedNotice.setAdminEmail(adminUser.getEmail());
+ joinedNotice.setJoinedUserName(joinUser.getFirstName());
+ joinedNotice.setJoinedUserEmail(joinUser.getEmail());
+ joinedNotice.setJoinedUserEditUrl(joinedUserEidtUrl);
+
+ StringWriter writer = new StringWriter();
+ m.execute(writer, joinedNotice).flush();
+
+ String htmlBody = writer.toString();
+
+ message.setContent(htmlBody, "text/html;charset=utf-8");
+ log.debug("Send user joined notification email.");
+
+ sendEmail(message);
+ }
+ } catch (Exception e) {
+ log.error("Send user join notification error {}.", e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ public void sendTestEmail(String userMail) throws Exception {
+ EmailInfo emailInfo = getEmailInfo();
+ if (emailInfo == null) {
+ log.error("The email not config.");
+ throw new EmailSendException();
+ }
+
+ Session mailSession = getEmailSession(emailInfo);
+ if (mailSession == null) {
+ log.error("send reset password fail,get session error.");
+ throw new EmailSendException();
+ }
+
+ Message message = new MimeMessage(mailSession);
+ if (emailInfo.getFromAddress() == null) {
+ message.setFrom(new InternetAddress());
+ } else {
+ message.setFrom(new InternetAddress(emailInfo.getFromAddress()));
+ }
+ message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(userMail));
+
+ // TODO:The name is temporarily in Chinese
+ message.setSubject(MimeUtility.encodeText("[Doris Studio] 测试邮件", "utf-8", null));
+
+ String testContent = "Your Doris Studio emails are working — hooray!";
+ // Text content of the message
+ message.setContent(testContent, "text/html;charset=UTF-8");
+
+ Transport.send(message);
+ log.debug("send mail success.");
+ }
+
+ /**
+ * Check whether the cache exists
+ * @return
+ */
+ public boolean checkConfigExist() {
+ SettingEntity emailConfiguredKey = settingComponent.readSetting(ConfigConstant.EMAIL_CONFIGURED_KEY);
+ if (emailConfiguredKey == null) {
+ log.debug("The email config not exist");
+ return false;
+ } else {
+ log.debug("The email config exist");
+ return true;
+ }
+ }
+
+ /**
+ * Get configured mailbox service information
+ * @return
+ */
+ public EmailInfo getEmailInfo() {
+ log.debug("Get email info from setting.");
+
+ boolean configured = checkConfigExist();
+ if (!configured) {
+ return null;
+ }
+
+ EmailInfo emailInfo = new EmailInfo();
+
+ SettingEntity hostSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_HOST_KEY);
+ if (hostSettingEntity != null) {
+ emailInfo.setSmtpHost(hostSettingEntity.getValue());
+ }
+
+ SettingEntity portSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_PORT_KEY);
+ if (portSettingEntity != null) {
+ emailInfo.setSmtpPort(portSettingEntity.getValue());
+ }
+
+ SettingEntity addressSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_ADDRESS_KEY);
+ if (addressSettingEntity != null) {
+ emailInfo.setFromAddress(addressSettingEntity.getValue());
+ }
+
+ SettingEntity secSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_SECURITY_KEY);
+ if (secSettingEntity != null) {
+ emailInfo.setSmtpSecurity(secSettingEntity.getValue());
+ }
+
+ if (emailInfo.getSmtpSecurity() != null
+ && !emailInfo.getSmtpSecurity().equals(EmailInfo.SmtpSecurity.none.name())) {
+ SettingEntity passwdSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_USER_NAME_KEY);
+ if (passwdSettingEntity != null) {
+ emailInfo.setSmtpUsername(passwdSettingEntity.getValue());
+ }
+
+ SettingEntity userSettingEntity = settingComponent.readSetting(ConfigConstant.EMAIL_PASSWORD_KEY);
+ if (userSettingEntity != null) {
+ emailInfo.setSmtpPassword(userSettingEntity.getValue());
+ }
+ }
+
+ return emailInfo;
+ }
+
+ /**
+ * Send mail asynchronously
+ *
+ * @param message
+ */
+ protected void sendEmail(Message message) {
+ ExecutorService threadPool = Executors.newFixedThreadPool(1);
+ MailComponent.MailSender sender = new MailComponent.MailSender(message);
+ threadPool.submit(sender);
+ }
+
+ /**
+ * Get send mail session information
+ * @param emailInfo
+ * @return
+ */
+ protected Session getEmailSession(EmailInfo emailInfo) {
+ try {
+ log.info("Get email session by email info.");
+
+ Properties props = new Properties();
+ props.put("mail.transport.protocol", ConfigConstant.EMAIL_PROTOCOL_KEY);
+ props.put("mail.smtp.host", emailInfo.getSmtpHost());
+ props.put("mail.smtp.port", emailInfo.getSmtpPort());
+ EmailInfo.SmtpSecurity smtpSecurity = EmailInfo.SmtpSecurity.valueOf(emailInfo.getSmtpSecurity());
+ switch (smtpSecurity) {
+ case ssl:
+ props.put("mail.smtp.auth", true);
+ props.put("mail.smtp.ssl.enable", true);
+ props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ break;
+ case tls:
+ props.put("mail.smtp.starttls.enable", true);
+ break;
+ case starttls:
+ props.put("mail.smtp.auth", false);
+ props.put("mail.smtp.socketFactory.port", emailInfo.getSmtpHost());
+ props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+ props.put("mail.smtp.socketFactory.fallback", false);
+ props.put("mail.smtp.starttls.enable", true);
+ break;
+ case none:
+ props.put("mail.smtp.auth", false);
+ break;
+ default:
+ break;
+ }
+
+ Session session = null;
+ if (smtpSecurity == EmailInfo.SmtpSecurity.none) {
+ session = Session.getDefaultInstance(props);
+ } else {
+ Authenticator auth = new Authenticator() {
+ public PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(emailInfo.getSmtpUsername(), emailInfo.getSmtpPassword());
+ }
+ };
+ session = Session.getInstance(props, auth);
+ }
+ return session;
+ } catch (Exception e) {
+ log.error("Get Email session exception {}", e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class Application {
+
+ private String applicationName = "Doris Studio";
+
+ private String applicationLogoUrl = LOG_URL;
+ }
+
+ /**
+ * Reset password message content
+ */
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class ResetPassword extends MailComponent.Application {
+
+ private String hostname;
+
+ private String passwordResetUrl;
+ }
+
+ /**
+ * Invite new users to add mail content
+ */
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ private static class NewUserInvitation extends MailComponent.Application {
+
+ private String invitorName;
+
+ private String joinUrl;
+
+ private Date today = new Date();
+ }
+
+ /**
+ * User has added reminder email content
+ */
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ private static class UserJoinedNotice extends MailComponent.Application {
+
+ private String joinedUserName;
+
+ private String adminEmail;
+
+ private String joinedUserEmail;
+
+ private Date joinedDate = new Date();
+
+ private String joinedUserEditUrl;
+
+ private String joinedViaSSO;
+
+ }
+
+ protected class MailSender implements Runnable {
+
+ private Message message;
+
+ public MailSender(Message message) {
+ this.message = message;
+ }
+
+ @Override
+ public void run() {
+ try {
+ Transport.send(message);
+ log.debug("send mail success.");
+ } catch (MessagingException e) {
+ log.error("Send message exception {}", e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/SettingComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/SettingComponent.java
new file mode 100644
index 0000000..8596c33
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/SettingComponent.java
@@ -0,0 +1,273 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import org.apache.doris.stack.model.response.config.SettingItem;
+import org.apache.doris.stack.constant.PropertyDefine;
+import org.apache.doris.stack.dao.SettingRepository;
+import org.apache.doris.stack.dao.StudioSettingRepository;
+import org.apache.doris.stack.entity.SettingEntity;
+import org.apache.doris.stack.entity.StudioSettingEntity;
+import org.apache.doris.stack.entity.StudioSettingEntityPk;
+import org.apache.doris.stack.service.config.ConfigCache;
+import org.apache.doris.stack.service.config.ConfigConstant;
+import org.apache.doris.stack.service.config.ConfigItem;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+@Component
+@Slf4j
+public class SettingComponent {
+
+ @Autowired
+ private SettingRepository settingRepository;
+
+ @Autowired
+ private StudioSettingRepository studioSettingRepository;
+
+ /**
+ * Add or update a new global configuration item, store it in the database, and write it to the cache
+ * @param key
+ * @param value
+ * @param configCache
+ */
+ public SettingEntity addNewSetting(String key, String value, Map<String, String> configCache) throws Exception {
+ log.debug("Add a new common setting key {} value {}.", key, value);
+ if (ConfigConstant.ALL_PUBLIC_CONFIGS.containsKey(key)) {
+ SettingEntity settingItem = new SettingEntity(key, value);
+ settingRepository.save(settingItem);
+ configCache.put(key, value);
+ return settingItem;
+ } else {
+ log.error("Input key {} error.", key);
+ throw new Exception("Configuration common key does not exist.");
+ }
+ }
+
+ /**
+ * Add or update a new global configuration item, store it in the database, and write it to the cache
+ * @param key
+ * @param value
+ */
+ public SettingEntity addNewSetting(String key, String value) throws Exception {
+ log.debug("Add a new common setting key {} value {}.", key, value);
+ if (ConfigConstant.ALL_PUBLIC_CONFIGS.containsKey(key)) {
+ SettingEntity settingItem = new SettingEntity(key, value);
+ settingRepository.save(settingItem);
+ ConfigCache.writeConfig(key, value);
+ return settingItem;
+ } else {
+ log.error("Input key {} error.", key);
+ throw new Exception("Configuration common key does not exist.");
+ }
+ }
+
+ /**
+ * Read a global configuration item
+ * Read the cache before reading the contents
+ * Returns NULL if it does not exist
+ *
+ * @param key
+ * @return
+ */
+ public SettingEntity readSetting(String key) {
+ log.debug("Read a common setting key {}.", key);
+ String value = ConfigCache.readConfig(key);
+
+ if (value == null) {
+ log.debug("Cache not exist.");
+ Optional<SettingEntity> settingEntity = settingRepository.findById(key);
+ if (settingEntity.equals(Optional.empty())) {
+ log.debug("The setting not exist");
+ return null;
+ } else {
+ log.debug("The setting exist");
+ value = settingEntity.get().getValue();
+ ConfigCache.writeConfig(key, value);
+ }
+ }
+ return new SettingEntity(key, value);
+ }
+
+ /**
+ * Delete a global configuration item
+ * @param key
+ */
+ public void deleteSetting(String key) {
+ log.debug("Delete a common setting key {}.", key);
+ settingRepository.deleteById(key);
+ ConfigCache.deleteConfig(key);
+ }
+
+ /**
+ * Read the mailbox configuration information and return to the configuration list.
+ * If the stored configuration item is empty, the default value is returned directly
+ * @return
+ */
+ public List<SettingItem> getUserEmailConfig() {
+ List<SettingItem> emailSettings = new ArrayList<>();
+
+ for (String key : ConfigConstant.EMAIL_CONFIGS.keySet()) {
+ ConfigItem item = ConfigConstant.EMAIL_CONFIGS.get(key);
+ SettingEntity entity = readSetting(key);
+ SettingItem settingItem = item.transSettingToModel(entity);
+ emailSettings.add(settingItem);
+ }
+
+ return emailSettings;
+ }
+
+ /**
+ * Add a new space configuration item, store it in the database, and write it to the cache
+ * @param clusterId
+ * @param key
+ * @param value
+ */
+ public StudioSettingEntity addNewAdminSetting(int clusterId, String key, String value) throws Exception {
+ log.debug("Add a new admin setting key {} value {} for cluster {}.", key, value, clusterId);
+ if (ConfigConstant.ALL_ADMIN_CONFIGS.containsKey(key)) {
+ StudioSettingEntity studioSettingEntity = new StudioSettingEntity(key, clusterId, value);
+ studioSettingRepository.save(studioSettingEntity);
+ ConfigCache.writeAdminConfig(clusterId, key, value);
+ return studioSettingEntity;
+ } else {
+ log.error("Input key {} error.", key);
+ throw new Exception("Configuration admin key does not exist.");
+ }
+ }
+
+ /**
+ * Read a space configuration item
+ * Read the cache before reading the contents
+ * Returns NULL if it does not exist
+ *
+ * @param key
+ * @return
+ */
+ public StudioSettingEntity readAdminSetting(int clusterId, String key) {
+ log.debug("Read a admin setting key {} from cluster {}.", key, clusterId);
+ String value = ConfigCache.readAdminConfig(clusterId, key);
+
+ if (value == null) {
+ log.debug("Cache not exist.");
+ StudioSettingEntityPk entityKey = new StudioSettingEntityPk(key, clusterId);
+ Optional<StudioSettingEntity> settingEntity = studioSettingRepository.findById(entityKey);
+ if (settingEntity.equals(Optional.empty())) {
+ log.debug("The setting not exist");
+ return null;
+ } else {
+ log.debug("The setting exist");
+ value = settingEntity.get().getValue();
+ ConfigCache.writeAdminConfig(clusterId, key, value);
+ }
+ }
+
+ return new StudioSettingEntity(key, clusterId, value);
+ }
+
+ public void deleteAdminSetting(int clusterId, String key) {
+ log.debug("Delete a admin setting key {} form cluster {}.", key, clusterId);
+ StudioSettingEntityPk settingEntityPk = new StudioSettingEntityPk(key, clusterId);
+ studioSettingRepository.deleteById(settingEntityPk);
+ ConfigCache.deleteAdminConfig(clusterId, key);
+ }
+
+ public void deleteAdminSetting(int clusterId) {
+ log.debug("Delete all admin settings form cluster {}.", clusterId);
+ studioSettingRepository.deleteByClusterId(clusterId);
+ ConfigCache.deleteAdminConfig(clusterId);
+ }
+
+ /**
+ * Read a space configuration item
+ * Read the cache before reading the contents
+ * If it does not exist, the default value of the configuration item is returned
+ *
+ * @param key
+ * @return
+ */
+ public String readAdminSettingOrDefault(int clusterId, String key) {
+ log.debug("Read a admin setting key {} from cluster {}.", key, clusterId);
+
+ StudioSettingEntity valueEntity = readAdminSetting(clusterId, key);
+ String value;
+ if (valueEntity == null) {
+ log.debug("The setting not exist,read default value.");
+ ConfigItem item = ConfigConstant.ALL_ADMIN_CONFIGS.get(key);
+ value = item.getDefaultValue();
+ } else {
+ value = valueEntity.getValue();
+ }
+
+ return value;
+ }
+
+ // enable-public-sharing
+ /**
+ * Judge whether the current stack service is open for public sharing
+ * @return
+ */
+ public boolean publicSharingEnable() {
+ log.debug("Judge whether public sharing enable.");
+ SettingEntity enablePublicSharing = readSetting(ConfigConstant.ENABLE_PUBLIC_KEY);
+ if (enablePublicSharing == null) {
+ return false;
+ }
+ return Boolean.valueOf(enablePublicSharing.getValue());
+ }
+
+ /**
+ * Judge whether the mailbox service is enabled for the current stack service
+ * @return
+ */
+ public boolean emailEnable() {
+ log.debug("Judge whether email enable.");
+ SettingEntity enableEmail = readSetting(ConfigConstant.EMAIL_CONFIGURED_KEY);
+ if (enableEmail == null) {
+ return false;
+ }
+ return Boolean.parseBoolean(enableEmail.getValue());
+ }
+
+ /**
+ * Judge whether the current studio service has its own sample data
+ * The engine type must be MySQL and the user has enabled the sample data
+ * @return
+ */
+ public boolean sampleDataEnable() {
+ log.debug("Judge whether sample data enable.");
+ SettingEntity sampleDataEnable = readSetting(ConfigConstant.SAMPLE_DATA_ENABLE_KEY);
+ if (sampleDataEnable == null) {
+ return false;
+ }
+ boolean isEnable = Boolean.parseBoolean(sampleDataEnable.getValue());
+
+ SettingEntity dbType = readSetting(ConfigConstant.DATABASE_TYPE_KEY);
+ if (dbType == null) {
+ return false;
+ }
+ return isEnable && dbType.getValue().equals(PropertyDefine.JPA_DATABASE_MYSQL);
+ }
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/component/UserActivityComponent.java b/manager/general/src/main/java/org/apache/doris/stack/component/UserActivityComponent.java
new file mode 100644
index 0000000..a4c2bb0
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/component/UserActivityComponent.java
@@ -0,0 +1,69 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.component;
+
+import com.alibaba.fastjson.JSON;
+import org.apache.doris.stack.model.activity.ActivityInfoResp;
+import org.apache.doris.stack.model.activity.ActivityModelType;
+
+import org.apache.doris.stack.model.activity.Topic;
+import org.apache.doris.stack.dao.ActivityRepository;
+import org.apache.doris.stack.entity.ActivityEntity;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+@Component
+@Slf4j
+public class UserActivityComponent {
+
+ @Autowired
+ private ActivityRepository activityRepository;
+
+ /**
+ * Add the log of user login. If you log in for the first time, add two topics: user joined and user login.
+ * If it is not the first time, update the time of user login
+ * @param userId
+ */
+ public void userLoginActivity(int userId) {
+ String model = ActivityModelType.user.name();
+ List<ActivityEntity> activityEntities = activityRepository.getByModelAndUserId(model, userId);
+ if (activityEntities == null || activityEntities.isEmpty()) {
+ log.debug("The user {} first login, add user joined and login activity.", userId);
+ // 添加join
+ ActivityInfoResp.Details details = new ActivityInfoResp.Details();
+ ActivityEntity joinedEntity = new ActivityEntity(Topic.USE_JOINED, model, JSON.toJSONString(details), userId, userId);
+ activityRepository.save(joinedEntity);
+ // 添加login
+ ActivityEntity longinEntity = new ActivityEntity(Topic.USE_LOGIN, model, JSON.toJSONString(details), userId, userId);
+ activityRepository.save(longinEntity);
+ } else {
+ for (ActivityEntity activityEntity : activityEntities) {
+ if (activityEntity.getTopic().equals(Topic.USE_LOGIN)) {
+ log.debug("Update user {} login activity {}.", userId, activityEntity.getId());
+ activityEntity.setTimestamp(new Timestamp(System.currentTimeMillis()));
+ activityRepository.save(activityEntity);
+ }
+ }
+ }
+ }
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/connector/LdapClient.java b/manager/general/src/main/java/org/apache/doris/stack/connector/LdapClient.java
new file mode 100644
index 0000000..7cac114
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/connector/LdapClient.java
@@ -0,0 +1,163 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.connector;
+
+import org.apache.doris.stack.model.ldap.LdapConnectionInfo;
+import org.apache.doris.stack.model.ldap.LdapUserInfo;
+import org.apache.doris.stack.model.ldap.LdapUserInfoReq;
+import com.unboundid.ldap.sdk.BindRequest;
+import com.unboundid.ldap.sdk.Filter;
+import com.unboundid.ldap.sdk.LDAPConnection;
+import com.unboundid.ldap.sdk.LDAPException;
+import com.unboundid.ldap.sdk.LDAPSearchException;
+import com.unboundid.ldap.sdk.SearchRequest;
+import com.unboundid.ldap.sdk.SearchResult;
+import com.unboundid.ldap.sdk.SearchResultEntry;
+import com.unboundid.ldap.sdk.SearchScope;
+import com.unboundid.ldap.sdk.SimpleBindRequest;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class LdapClient {
+
+ /**
+ * ldap Attributes
+ */
+ private static final String FIRST_NAME = "givenname";
+
+ private static final String LAST_NAME = "sn";
+
+ private static final String EMAIL = "mail";
+
+ private static final String GROUPS = "groups";
+
+ private static final String PASSWORD = "userpassword";
+
+ /**
+ * get LDAP connection information
+ *
+ * @param ldapConnectionInfo
+ * @return
+ */
+ public LDAPConnection getConnection(LdapConnectionInfo ldapConnectionInfo) {
+ try {
+ LDAPConnection connection = new LDAPConnection();
+ connection.connect(ldapConnectionInfo.getHost(), ldapConnectionInfo.getPort());
+ connection.bind(ldapConnectionInfo.getBindDn(), ldapConnectionInfo.getPassword());
+ return connection;
+ } catch (LDAPException e) {
+ log.error("get LDAP connection error: {}", e);
+ }
+ return null;
+ }
+
+ /**
+ * search LDAP user
+ *
+ * @param ldapConnection
+ * @param ldapUserInfoReq
+ * @return
+ */
+ public LdapUserInfo getUser(LDAPConnection ldapConnection, LdapUserInfoReq ldapUserInfoReq) {
+
+ LdapUserInfo ldapUserInfo = new LdapUserInfo();
+ ldapUserInfo.setExist(false);
+ for (String baseDn : ldapUserInfoReq.getBaseDn()) {
+ Filter userFilter = Filter
+ .createEqualityFilter(ldapUserInfoReq.getUserAttribute(), ldapUserInfoReq.getUserValue());
+ SearchRequest searchRequest = new SearchRequest(baseDn, SearchScope.SUB, userFilter);
+ searchRequest.setSizeLimit(1);
+ try {
+ SearchResult searchResult = ldapConnection.search(searchRequest);
+
+ // check
+ if (searchResult.getEntryCount() == 0 || searchResult.getSearchEntries().isEmpty()) {
+ log.error("We got No Entries for: {}", searchRequest.getFilter());
+ continue;
+ }
+
+ SearchResultEntry entry = searchResult.getSearchEntries().get(0);
+ ldapUserInfo.setDn(entry.getDN());
+ ldapUserInfo.setFirstName(entry.getAttributeValue(FIRST_NAME));
+ ldapUserInfo.setLastName(entry.getAttributeValue(LAST_NAME));
+ ldapUserInfo.setEmail(entry.getAttributeValue(EMAIL));
+ ldapUserInfo.setGroups(entry.getAttributeValue(GROUPS));
+ ldapUserInfo.setExist(true);
+ ldapUserInfo.setPassword(entry.getAttributeValue(PASSWORD));
+
+ return ldapUserInfo;
+ } catch (LDAPSearchException e) {
+ log.error("LDAP search user error: {}", e);
+ } catch (LDAPException e) {
+ log.error("LDAP exception error: {}", e);
+ }
+ }
+ return ldapUserInfo;
+ }
+
+ /**
+ * Authenticate the LDAP user and return the user information
+ *
+ * @param ldapConnection
+ * @param ldapUserInfoReq
+ * @return
+ */
+ public LdapUserInfo authenticate(LDAPConnection ldapConnection, LdapUserInfoReq ldapUserInfoReq) {
+
+ LdapUserInfo ldapUserInfo = new LdapUserInfo();
+ ldapUserInfo.setAuth(false);
+ for (String baseDn : ldapUserInfoReq.getBaseDn()) {
+ Filter userFilter = Filter.createEqualityFilter(ldapUserInfoReq.getUserAttribute(), ldapUserInfoReq.getUserValue());
+ SearchRequest searchRequest = new SearchRequest(baseDn, SearchScope.SUB, userFilter);
+ searchRequest.setSizeLimit(1);
+ try {
+ SearchResult searchResult = ldapConnection.search(searchRequest);
+
+ // check
+ if (searchResult.getEntryCount() > 1) {
+ log.error("We got more than one Entry for: {}", searchRequest.getFilter());
+ }
+ if (searchResult.getEntryCount() == 0 || searchResult.getSearchEntries().isEmpty()) {
+ log.error("We got No Entries for: {}", searchRequest.getFilter());
+ return ldapUserInfo;
+ }
+
+ SearchResultEntry entry = searchResult.getSearchEntries().get(0);
+ BindRequest bindRequest = new SimpleBindRequest(entry.getDN(), ldapUserInfoReq.getPassword());
+ ldapConnection.bind(bindRequest);
+
+ ldapUserInfo.setDn(entry.getDN());
+ ldapUserInfo.setFirstName(entry.getAttributeValue(FIRST_NAME));
+ ldapUserInfo.setLastName(entry.getAttributeValue(LAST_NAME));
+ ldapUserInfo.setEmail(entry.getAttributeValue(EMAIL));
+ ldapUserInfo.setGroups(entry.getAttributeValue(GROUPS));
+ ldapUserInfo.setAuth(true);
+ return ldapUserInfo;
+ } catch (LDAPSearchException e) {
+ log.error("LDAP search user error: {}", e);
+ } catch (LDAPException e) {
+ log.error("LDAP authenticate failed error: {}", e);
+ } catch (Exception e) {
+ log.error("LDAP authenticate error: {}", e);
+ }
+ }
+ return ldapUserInfo;
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/constant/ConstantDef.java b/manager/general/src/main/java/org/apache/doris/stack/constant/ConstantDef.java
new file mode 100644
index 0000000..ac551ab
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/constant/ConstantDef.java
@@ -0,0 +1,114 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.constant;
+
+import com.google.common.collect.Maps;
+
+import java.util.Map;
+
+/**
+ * @Description:Uniform constant definition
+ */
+public class ConstantDef {
+
+ // General constant definition
+ // Separator
+ public static final String UNDERLINE = "_";
+
+ // The related name definition of the default metadata of the Doris engine
+ //Default namespace for Doris engine
+ public static final String DORIS_DEFAULT_NS = "default_cluster";
+
+ // MySQL (Doris is the same as MySQL) has its own default metabase name
+ public static final String MYSQL_DEFAULT_SCHEMA = "information_schema";
+
+ // MySQL (Doris is consistent with MySQL) has its own default metabase ID,
+ // which does not really exist in the metabase
+ public static final int MYSQL_SCHEMA_DB_ID = -1;
+
+ // Metadata information table of MySQL (Doris is consistent with MySQL)
+ public static final Map<Integer, String> MYSQL_METADATA_TABLE;
+ static {
+ MYSQL_METADATA_TABLE = Maps.newHashMap();
+ MYSQL_METADATA_TABLE.put(-1, "character_sets");
+ MYSQL_METADATA_TABLE.put(-2, "collations");
+ MYSQL_METADATA_TABLE.put(-3, "columns");
+ MYSQL_METADATA_TABLE.put(-4, "engines");
+ MYSQL_METADATA_TABLE.put(-5, "global_variables");
+ MYSQL_METADATA_TABLE.put(-6, "key_column_usage");
+ MYSQL_METADATA_TABLE.put(-7, "referential_constraints");
+ MYSQL_METADATA_TABLE.put(-8, "routines");
+ MYSQL_METADATA_TABLE.put(-9, "schema_privileges");
+ MYSQL_METADATA_TABLE.put(-10, "schemata");
+ MYSQL_METADATA_TABLE.put(-11, "session_variables");
+ MYSQL_METADATA_TABLE.put(-12, "statistics");
+ MYSQL_METADATA_TABLE.put(-13, "table_constraints");
+ MYSQL_METADATA_TABLE.put(-14, "table_privileges");
+ MYSQL_METADATA_TABLE.put(-15, "tables");
+ MYSQL_METADATA_TABLE.put(-16, "user_privileges");
+ MYSQL_METADATA_TABLE.put(-17, "views");
+ }
+
+ // user constant definition
+ // By default, there is no space ID assigned
+ public static final int NON_CLUSTER = -1;
+
+ // user_id of super administrator in session table
+ public static final int SUPER_USER_ID = 0;
+
+ // The default user group name when the user does not have any space
+ public static final String USER_DEFAULT_GROUP_NAME = "Default";
+
+ // Front end request tag name
+ public static final String REQUEST_INDENTIFIER = "Request-Id";
+
+ // Log builder Key definition
+ // Log unique request identifier key
+ public static final String LOG_INDENTIFIER = "RequestId";
+
+ // log message key
+ public static final String LOG_MESSAGE_KEY = "msg";
+
+ // log exception key
+ public static final String LOG_EXCEPTION_KEY = "exception";
+
+ // user Id
+ public static final String LOG_USER_ID_KEY = "user_id";
+
+ // user name
+ public static final String LOG_USER_NAME_KEY = "user_name";
+
+ // user login session id
+ public static final String LOG_SESSION_KEY = "session_id";
+
+ // doris space(Cluster)id
+ public static final String LOG_CLUSTER_ID_KEY = "cluster_id";
+
+ // database id
+ public static final String LOG_DATABASE_ID_KEY = "database_id";
+
+ // table id
+ public static final String LOG_TABLE_ID_KEY = "table_id";
+
+ // field id
+ public static final String LOG_FIELD_ID_KEY = "field_id";
+
+ // new token mark
+ public static final String NEW_TOKEN_MARK = "new#";
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/constant/EnvironmentDefine.java b/manager/general/src/main/java/org/apache/doris/stack/constant/EnvironmentDefine.java
new file mode 100644
index 0000000..a83f12f
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/constant/EnvironmentDefine.java
@@ -0,0 +1,100 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.constant;
+
+/**
+ * @Description:Defines the name of the environment variable that can be read when the service starts
+ * Some of these environment variables are written to the system configuration properties to
+ * initialize the service container.
+ * In addition, when initializing the configuration, it will be persisted and stored
+ * in the configuration table setting of the service.
+ * A small part will be written into the properties and also stored in the configuration table setting,
+ * such as the storage engine type used by the service.
+ */
+public class EnvironmentDefine {
+
+ private EnvironmentDefine() {
+ throw new UnsupportedOperationException();
+ }
+
+ // Environment variable name definition
+ // Data storage engine type environment variable
+ public static final String DB_TYPE_ENV = "MB_DB_TYPE";
+
+ // Datastore database name environment variable
+ public static final String DB_DBNAME_ENV = "MB_DB_DBNAME";
+
+ // Data storage connection port environment variable
+ public static final String DB_PORT_ENV = "MB_DB_PORT";
+
+ // Data storage connection port environment variable
+ public static final String DB_USER_ENV = "MB_DB_USER";
+
+ // Data storage connection port environment variable
+ public static final String DB_PASS_ENV = "MB_DB_PASS";
+
+ // Data storage connection port environment variable
+ public static final String DB_HOST_ENV = "MB_DB_HOST";
+
+ // Data storage connection port environment variable
+ public static final String STUDIO_PORT_ENV = "STUDIO_PORT";
+
+ // Data storage connection port environment variable
+ public static final String NGINX_PORT_ENV = "NGINX_PORT";
+
+ // Set cookie validity environment variable
+ public static final String STUDIO_COOKIE_MAX_AGE_ENV = "STUDIO_COOKIE_MAX_AGE";
+
+ // Data storage connection port environment variable
+ public static final String SUPER_PASSWORD_RESER_ENV = "SUPER_PASSWORD_RESER";
+
+ // Data storage connection port environment variable
+ public static final String MAX_LOGIN_FAILED_TIMES_ENV = "MAX_LOGIN_FAILED_TIMES";
+
+ // Data storage connection port environment variable
+ public static final String LOGIN_DELAY_TIME_ENV = "LOGIN_DELAY_TIME";
+
+ // Data storage connection port environment variable
+ public static final String MAX_LOGIN_TIMES_IN_FIVE_MINUTES_ENV = "MAX_LOGIN_TIMES_IN_FIVE_MINUTES";
+
+ // Data storage connection port environment variable
+ public static final String MAX_LOGIN_TIMES_ENV = "MAX_LOGIN_TIMES";
+
+ public static final String ADMIN_EMAIL_ENV = "DS_ADMIN_EMAIL";
+
+ public static final String ANON_TRACKING_ENABLED_ENV = "DS_ANON_TRACKING_ENABLED";
+
+ public static final String REDIRECT_HTTPS_ENV = "DS_REDIRECT_ALL_REQUESTS_TO_HTTPS";
+
+ public static final String SITE_LOCALE_ENV = "DS_SITE_LOCALE";
+
+ public static final String SITE_NAME_ENV = "DS_SITE_NAME";
+
+ public static final String SITE_URL_ENV = "DS_SITE_URL";
+
+ public static final String VERSION_INFO_ENV = "DS_VERSION_INFO";
+
+ public static final String DEFAULT_GROUP_ID_ENV = "DS_DEFAULT_GROUP_ID";
+
+ public static final String ENABLE_PUBLIC_KEY_ENV = "ENABLE_PUBLIC_SHARING";
+
+ public static final String CUSTOM_FORMATTING_KEY_ENV = "CUSTOM_FORMATTING";
+
+ public static final String SAMPLE_DATA_ENABLE_KEY_ENV = "SAMPLE_DATA_ENABLE";
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/constant/PropertyDefine.java b/manager/general/src/main/java/org/apache/doris/stack/constant/PropertyDefine.java
new file mode 100644
index 0000000..53ef423
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/constant/PropertyDefine.java
@@ -0,0 +1,82 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.constant;
+
+/**
+ * @Description:properties System configuration name and content definition
+ */
+public class PropertyDefine {
+
+ private PropertyDefine() {
+ throw new UnsupportedOperationException();
+ }
+
+ // Configuration item name definition
+ // Application name configuration item
+ public static final String DEPLOY_TYPE_PROPERTY = "deploy.type";
+
+ // Application background storage database type configuration item
+ public static final String JPA_DATABASE_PROPERTY = "spring.jpa.database";
+
+ // Application port configuration item
+ public static final String SERVER_PORT_PROPERTY = "server.port";
+
+ // Application nginx service port configuration item
+ public static final String NGINX_PORT_PROPERTY = "nginx.port";
+
+ // Connection address configuration item of MySQL engine
+ public static final String MYSQL_HOST_PROPERTY = "mysql.host";
+
+ // Connection port configuration item of MySQL engine
+ public static final String MYSQL_PORT_PROPERTY = "mysql.port";
+
+ // Connection address configuration item of PostgreSQL engine
+ public static final String POSTGRESQL_HOST_PROPERTY = "postgresql.host";
+
+ // Connection port configuration item of PostgreSQL engine
+ public static final String POSTGRESQL_PORT_PROPERTY = "postgresql.port";
+
+ public static final String MAX_SESSION_AGE_PROPERTY = "max.session.age";
+
+ public static final String SUPER_USER_PASS_RESET_PROPERTY = "super.user.password.reset";
+
+ public static final String MAX_LOGIN_FAILED_TIMES_PROPERTY = "max.login.failed.times";
+
+ public static final String LOGIN_DELAY_TIME_PROPERTY = "login.delay.time";
+
+ public static final String MAX_LOGIN_TIMES_IN_FIVE_MINUTES_PROPERTY = "max.login.times.in.five.minutes";
+
+ public static final String MAX_LOGIN_TIMES_PROPERTY = "max.login.times";
+
+ // Definition of special configuration item value
+ // Application name configuration item value, studio application name
+ public static final String DEPLOY_TYPE_STUDIO = "studio";
+
+ // Application name, configuration item value, manager application name
+ public static final String DEPLOY_TYPE_MANAGER = "manager";
+
+ // The application background uses the storage database type configuration item value, MySQL database
+ public static final String JPA_DATABASE_MYSQL = "mysql";
+
+ // The application background uses the storage database type configuration item value, H2 database
+ public static final String JPA_DATABASE_H2 = "h2";
+
+ // The application background uses the storage database type configuration item value, and PostgreSQL database
+ public static final String JPA_DATABASE_POSTGRESQL = "postgresql";
+
+}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentRoleEntity.java b/manager/general/src/main/java/org/apache/doris/stack/controller/BaseController.java
similarity index 50%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentRoleEntity.java
rename to manager/general/src/main/java/org/apache/doris/stack/controller/BaseController.java
index fd0c82c..8fe43fd 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/entity/AgentRoleEntity.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/BaseController.java
@@ -14,46 +14,35 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.entity;
-public class AgentRoleEntity {
+package org.apache.doris.stack.controller;
- private String host;
+public class BaseController {
- private String role;
+ protected static final String NS_KEY = "nsId";
- private String installDir;
+ protected static final String DB_KEY = "dbId";
- public AgentRoleEntity() {
- }
+ protected static final String TABLE_KEY = "tableId";
- public AgentRoleEntity(String host, String role,String installDir) {
- this.host = host;
- this.role = role;
- this.installDir = installDir;
- }
+ protected static final String SCHEMA_KEY = "schema";
- public String getHost() {
- return host;
- }
+ protected static final String USER_KEY = "userId";
- public void setHost(String host) {
- this.host = host;
- }
+ protected static final String ID = "id";
- public String getRole() {
- return role;
- }
+ protected static final String DATABASES = "databases";
- public void setRole(String role) {
- this.role = role;
- }
+ protected static final String FIELDS = "fields";
- public String getInstallDir() {
- return installDir;
- }
+ protected static final String NAMESPACE = "namespace";
+
+ protected static final String TABLE = "table";
+
+ protected static final String TABLES = "tables";
+
+ protected static final String DATABASE = "database";
+
+ protected static final String SPACE_KEY = "spaceId";
- public void setInstallDir(String installDir) {
- this.installDir = installDir;
- }
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/UtilController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/UtilController.java
new file mode 100644
index 0000000..b247d1a
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/UtilController.java
@@ -0,0 +1,56 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller;
+
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.UtilService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @Description:
+ */
+@Api(tags = "Tool API, which provides a general tool API without permission verification")
+@RestController
+@RequestMapping(value = "/api/util")
+@Slf4j
+public class UtilController {
+
+ @Autowired
+ private UtilService utilService;
+
+ @ApiOperation(value = "Check the user password specification, "
+ + "and check whether the returned password meets the specification。")
+ @PostMapping(value = "/password_check", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object passwordCheck(
+ HttpServletRequest request, HttpServletResponse response,
+ @RequestBody String passwd) throws Exception {
+ log.debug("password check.");
+ return ResponseEntityBuilder.ok(utilService.passwordCheck(passwd));
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/config/EmailController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/config/EmailController.java
new file mode 100644
index 0000000..f201a9f
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/config/EmailController.java
@@ -0,0 +1,93 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.config;
+
+import org.apache.doris.stack.model.request.config.EmailInfo;
+import org.apache.doris.stack.model.request.config.TestEmailReq;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.config.EmailService;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Api(tags = "Mailbox information configuration API")
+@RestController
+@RequestMapping(value = "/api/email/")
+@Slf4j
+public class EmailController {
+
+ @Autowired
+ private AuthenticationService authenticationService;
+
+ @Autowired
+ private EmailService emailService;
+
+ @ApiOperation(value = "Get mailbox service configuration information(super administrator/space administrator access)")
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getEmailSmtp(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ log.debug("Admin user update email service info.");
+ int userId = authenticationService.checkAllUserAuthWithCookie(request, response);
+ if (userId > 0) {
+ authenticationService.checkUserIsAdmin(userId);
+ }
+ return ResponseEntityBuilder.ok(emailService.getEmailConfig(userId));
+ }
+
+ @ApiOperation(value = "Configure mailbox service information(super administrator access)")
+ @PutMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object updateEmailSmtp(@RequestBody EmailInfo emailInfo,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("Super Admin user update email service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ emailService.updateEmailInfo(emailInfo);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Empty mailbox service information(super administrator access)")
+ @DeleteMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object deleteEmailSmtp(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ log.debug("Admin user update email service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ emailService.deleteEmailInfo();
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Send a test email to verify the mailbox service(super administrator access)")
+ @PostMapping(value = "test", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object testEmail(@RequestBody TestEmailReq testEmailReq, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ log.debug("Admin user update email service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+
+ emailService.sendTestEmail(testEmailReq);
+ return ResponseEntityBuilder.ok();
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/config/IdaasController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/config/IdaasController.java
new file mode 100644
index 0000000..c28f1b0
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/config/IdaasController.java
@@ -0,0 +1,70 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.apache.doris.stack.model.request.config.IdaasSettingReq;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.config.IdaasService;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Api(tags = "Idaas authentication information configuration API")
+@RestController
+@RequestMapping(value = "/api/idaas/")
+@Slf4j
+public class IdaasController {
+
+ @Autowired
+ private IdaasService idaasService;
+
+ @Autowired
+ private AuthenticationService authenticationService;
+
+ @ApiOperation(value = "config IDAAS(super administrator access)")
+ @PutMapping(value = "setting", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object setting(@RequestBody IdaasSettingReq idaasSettingReq, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ log.debug("Admin User update IDAAS service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ idaasService.update(idaasSettingReq);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "get IDAAS configuration (super administrator access)")
+ @GetMapping(value = "setting", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object setting(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ log.debug("Admin User get IDAAS service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(idaasService.setting());
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/config/LdapController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/config/LdapController.java
new file mode 100644
index 0000000..e532aa4
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/config/LdapController.java
@@ -0,0 +1,70 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.config;
+
+import org.apache.doris.stack.model.request.config.LdapSettingReq;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.config.LdapService;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Api(tags = "LDAP authentication information configuration API")
+@RestController
+@RequestMapping(value = "/api/ldap/")
+@Slf4j
+public class LdapController {
+
+ @Autowired
+ private LdapService ldapService;
+
+ @Autowired
+ private AuthenticationService authenticationService;
+
+ @ApiOperation(value = "config LDAP(super administrator access)")
+ @PutMapping(value = "setting", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object setting(@RequestBody LdapSettingReq ldapSettingReq, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ log.debug("Admin User update LDAP service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ ldapService.update(ldapSettingReq);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "get LDAP configuration(super administrator access)")
+ @GetMapping(value = "setting", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object setting(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ log.debug("Admin User update LDAP service info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(ldapService.setting());
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/config/SettingController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/config/SettingController.java
new file mode 100644
index 0000000..7d29668
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/config/SettingController.java
@@ -0,0 +1,126 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.config;
+
+import org.apache.doris.stack.model.request.config.ConfigUpdateReq;
+import org.apache.doris.stack.model.request.config.InitStudioReq;
+import org.apache.doris.stack.model.response.config.SettingItem;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.config.SettingService;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Api(tags = "configuration information API")
+@RestController
+@RequestMapping(value = "/api/setting/")
+@Slf4j
+public class SettingController {
+
+ @Autowired
+ private AuthenticationService authenticationService;
+
+ @Autowired
+ private SettingService settingService;
+
+ @ApiOperation(value = "Initialize stack service authentication type(super administrator access)")
+ @PostMapping(value = "init/studio", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object initStudio(@RequestBody InitStudioReq initStudioReq, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("init studio.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ settingService.initStudio(initStudioReq);
+ log.debug("init studio successful.");
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Get all configuration information of the current space")
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getAllConfig(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("get config info.");
+ int userId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(userId);
+ return ResponseEntityBuilder.ok(settingService.getAllConfig(userId));
+ }
+
+ @ApiOperation(value = "Get all global configuration information of stack(super administrator access)")
+ @GetMapping(value = "global", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getAllGlobalConfig(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("get config info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(settingService.getAllPublicConfig());
+ }
+
+ @ApiOperation(value = "Get the information of a global configuration item by name(super administrator access)")
+ @GetMapping(value = "global/{key}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getGlobalConfigByKey(@PathVariable(value = "key") String key,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("get config info.");
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(settingService.getConfigByKey(key));
+ }
+
+ @ApiOperation(value = "Get the information of a configuration item by name(super administrator/space administrator access)")
+ @GetMapping(value = "{key}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getConfigByKey(@PathVariable(value = "key") String key,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("get config info.");
+ int userId = authenticationService.checkUserAuthWithCookie(request, response);
+ if (userId < 1) {
+ return ResponseEntityBuilder.ok(settingService.getConfigByKey(key));
+ } else {
+ authenticationService.checkUserIsAdmin(userId);
+ return ResponseEntityBuilder.ok(settingService.getConfigByKey(key, userId));
+ }
+ }
+
+ @ApiOperation(value = "Modify the information of a configuration item according to its name(super administrator/space administrator access)")
+ @PutMapping(value = "{key}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object updateConfigByKey(@PathVariable(value = "key") String key,
+ @RequestBody ConfigUpdateReq updateReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("get config info.");
+ int userId = authenticationService.checkAllUserAuthWithCookie(request, response);
+ SettingItem resutl;
+ if (userId < 1) {
+ resutl = settingService.superUpdateConfigByKey(key, updateReq);
+ } else {
+ authenticationService.checkUserIsAdmin(userId);
+ resutl = settingService.amdinUpdateConfigByKey(key, userId, updateReq);
+ }
+ return ResponseEntityBuilder.ok(resutl);
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/user/AuthenticationController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/user/AuthenticationController.java
new file mode 100644
index 0000000..ae276fa
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/user/AuthenticationController.java
@@ -0,0 +1,116 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.user;
+
+import org.apache.doris.stack.constant.ConstantDef;
+import org.apache.doris.stack.model.request.user.PasswordResetReq;
+import org.apache.doris.stack.model.request.user.UserLoginReq;
+import org.apache.doris.stack.model.response.user.PasswordResetResp;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.doris.stack.util.LogBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Api(tags = "User authentication API")
+@RestController
+@RequestMapping(value = "/api/session/")
+@Slf4j
+public class AuthenticationController {
+
+ @Autowired
+ private AuthenticationService authService;
+
+ @ApiOperation(value = "User login (super administrator / all users)")
+ @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object login(@RequestBody UserLoginReq loginReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ String requestId = authService.getRequestId(request);
+ log.debug(new LogBuilder(requestId)
+ .add(ConstantDef.LOG_USER_NAME_KEY, loginReq.getUsername())
+ .add(ConstantDef.LOG_MESSAGE_KEY, "user login.")
+ .build());
+ String sessionId = authService.login(loginReq, request);
+ authService.setResponseCookie(response, sessionId);
+ return ResponseEntityBuilder.ok(sessionId);
+ }
+
+ @ApiOperation(value = "User logout (super administrator / all users)")
+ @DeleteMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object logout(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ authService.logout(request, response);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "The user forgets the password and sends a password reset email to the mailbox")
+ @PostMapping(value = "forgot_password", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object forgetPasswd(@RequestBody String email,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("User forget password.");
+ String hostname = "";
+ authService.forgetPassword(email, hostname);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Reset the password via the reset password email link")
+ @PostMapping(value = "reset_password", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object resetPassword(@RequestBody PasswordResetReq resetReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("reset password by email link.");
+
+ PasswordResetResp resetResp = authService.resetPassword(resetReq);
+ authService.setResponseCookie(response, resetResp.getSessionId());
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Verify that the token for resetting the password is still valid")
+ @GetMapping(value = "password_reset_token_valid", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object resetTokenValid(
+ @RequestParam(value = "token") String token,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("check password reset token is valid.");
+ return ResponseEntityBuilder.ok(authService.resetTokenValid(token));
+ }
+
+ @ApiOperation(value = "Certified by Google, todo: not yet implemented")
+ @GetMapping(value = "google_auth", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object googeleAuth(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ log.debug("google auth.");
+ // TODO:google authentication, temporarily not implemented
+ return ResponseEntityBuilder.ok();
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/controller/user/UserController.java b/manager/general/src/main/java/org/apache/doris/stack/controller/user/UserController.java
new file mode 100644
index 0000000..e1b427e
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/controller/user/UserController.java
@@ -0,0 +1,218 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.controller.user;
+
+import org.apache.doris.stack.model.request.user.PasswordUpdateReq;
+import org.apache.doris.stack.model.request.user.UserAddReq;
+import org.apache.doris.stack.model.request.user.UserSpaceReq;
+import org.apache.doris.stack.model.request.user.UserUpdateReq;
+import org.apache.doris.stack.controller.BaseController;
+import org.apache.doris.stack.rest.ResponseEntityBuilder;
+import org.apache.doris.stack.service.user.AuthenticationService;
+import org.apache.doris.stack.service.user.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @Description:TODO:At present, a user can only be in one space, and a subsequent user may be in multiple spaces.
+ * TODO:At present, the user management in the space is implemented here,
+ * TODO:and the subsequent users must be modified uniformly
+ */
+@Api(tags = "User management in space API")
+@RestController
+@RequestMapping(value = "/api/user/")
+@Slf4j
+public class UserController extends BaseController {
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private AuthenticationService authenticationService;
+
+ /**
+ * The space administrator obtains the list of all users in the space.
+ * If includedeactivated is true, it means to obtain all users (active and inactive),
+ * If includedeactivated is false, the active user is obtained
+ *
+ * @param includeDeactivated
+ * @param request
+ * @param response
+ * @return
+ * @throws Exception
+ */
+ @ApiOperation(value = "The space administrator obtains the list of all users in the space")
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getUser(@RequestParam(value = "include_deactivated", defaultValue = "false") boolean includeDeactivated,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int userId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(userId);
+ log.debug("Admin user {} get user list.", userId);
+
+ return ResponseEntityBuilder.ok(userService.getAllUser(includeDeactivated, userId));
+ }
+
+ @ApiOperation(value = "Get the current logged in user information (space administrator/all users)")
+ @GetMapping(value = "current", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getCurrentUser(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int userId = authenticationService.checkAllUserAuthWithCookie(request, response);
+ if (userId < 1) {
+ return ResponseEntityBuilder.ok(authenticationService.getSuperUserInfo());
+ } else {
+ return ResponseEntityBuilder.ok(userService.getCurrentUser(userId));
+ }
+ }
+
+ @ApiOperation(value = "Get user information according to ID")
+ @GetMapping(value = "{" + USER_KEY + "}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getUserById(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(userService.getUserById(userId, requestUserId));
+ }
+
+ @ApiOperation(value = "Add new user")
+ @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object addUser(@RequestBody UserAddReq userAddReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(requestUserId);
+ return ResponseEntityBuilder.ok(userService.addUser(userAddReq, requestUserId));
+ }
+
+ @ApiOperation(value = "update user information")
+ @PutMapping(value = "{" + USER_KEY + "}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object updateUser(@RequestBody UserUpdateReq userUpdateReq,
+ @PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestId = authenticationService.checkUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(userService.updateUser(userUpdateReq, requestId, userId));
+ }
+
+ @ApiOperation(value = "Reactivate user")
+ @PutMapping(value = "{" + USER_KEY + "}" + "/reactivate", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object reactivateUser(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(requestUserId);
+ return ResponseEntityBuilder.ok(userService.reactivateUser(userId, requestUserId));
+ }
+
+ @ApiOperation(value = "Modify user password")
+ @PutMapping(value = "{" + USER_KEY + "}" + "/password", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object updatePassword(@PathVariable(value = USER_KEY) int userId,
+ @RequestBody PasswordUpdateReq updateReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestId = authenticationService.checkAllUserAuthWithCookie(request, response);
+ if (requestId < 1) {
+ return ResponseEntityBuilder.ok(authenticationService.updateSuperUserPassword(updateReq));
+ } else {
+ return ResponseEntityBuilder.ok(userService.updatePassword(updateReq, userId, requestId));
+ }
+ }
+
+ @ApiOperation(value = "Deactivating a user does not delete it, but deactivates it")
+ @DeleteMapping(value = "{" + USER_KEY + "}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object stopUser(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(requestUserId);
+ return ResponseEntityBuilder.ok(userService.stopUser(userId, requestUserId));
+ }
+
+ @ApiOperation(value = "User moves out of space")
+ @DeleteMapping(value = "/move/{" + USER_KEY + "}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object moveUser(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(requestUserId);
+ return ResponseEntityBuilder.ok(userService.moveUser(userId, requestUserId));
+ }
+
+ @ApiOperation(value = "update user qbnewb")
+ @PutMapping(value = "{" + USER_KEY + "}" + "/qbnewb", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object setQpnewb(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestId = authenticationService.checkUserAuthWithCookie(request, response);
+ return ResponseEntityBuilder.ok(userService.setQbnewb(requestId, userId));
+ }
+
+ @ApiOperation(value = "Resend invitation message")
+ @PostMapping(value = "{" + USER_KEY + "}" + "/send_invite", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object sendInvite(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int requestUserId = authenticationService.checkUserAuthWithCookie(request, response);
+ authenticationService.checkUserIsAdmin(requestUserId);
+ return ResponseEntityBuilder.ok(userService.sendInvite(requestUserId, userId));
+ }
+
+ @ApiOperation(value = "delete user")
+ @DeleteMapping(value = "delete/{" + USER_KEY + "}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object deleteUser(@PathVariable(value = USER_KEY) int userId,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ authenticationService.checkSuperAdminUserAuthWithCookie(request, response);
+ userService.deleteUser(userId);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "Get the list of all spaces where the user is located. Todo: not implemented yet")
+ @GetMapping(value = "spaces", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object getUserSpaces(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ int userId = authenticationService.checkUserAuthWithCookie(request, response);
+ log.debug("User {} get space list.", userId);
+ return ResponseEntityBuilder.ok();
+ }
+
+ @ApiOperation(value = "User switches the current space in use. Todo: not implemented yet")
+ @PutMapping(value = "space", produces = MediaType.APPLICATION_JSON_VALUE)
+ public Object updateUserSpace(@RequestBody UserSpaceReq userSpaceReq,
+ HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ int userId = authenticationService.checkUserAuthWithCookie(request, response);
+ log.debug("User {} get space list.", userId);
+ return ResponseEntityBuilder.ok();
+ }
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/ActivityRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/ActivityRepository.java
new file mode 100644
index 0000000..989a503
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/ActivityRepository.java
@@ -0,0 +1,51 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.ActivityEntity;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+public interface ActivityRepository extends JpaRepository<ActivityEntity, Integer>,
+ PagingAndSortingRepository<ActivityEntity, Integer> {
+
+ @Query("select s from ActivityEntity s where s.model = :model")
+ List<ActivityEntity> getByModel(@Param("model") String model);
+
+ @Query("select s from ActivityEntity s where s.model = :model and s.userId = :userId")
+ List<ActivityEntity> getByModelAndUserId(@Param("model") String model, @Param("userId") int userId);
+
+ @Query("select s from ActivityEntity s where s.model = :model and s.modelId = :modelId and s.userId = :userId")
+ List<ActivityEntity> getByModelAndModelIdAndUserId(@Param("model") String model,
+ @Param("modelId") int modelId,
+ @Param("userId") int userId);
+
+ @Query("select max(s.id) as max_id, s.userId, s.model, s.modelId from ActivityEntity s where s.model in (:models) "
+ + "and s.userId = :userId group by s.userId, s.model, s.modelId order by max_id desc")
+ List<List<String>> getByModelsGroupByUserIdAndModelAndModelId(@Param("models") List<String> models,
+ @Param("userId") int userId, Pageable pageable);
+
+ Page<ActivityEntity> findByUserId(int userId, Pageable pageable);
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/ClusterInfoRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/ClusterInfoRepository.java
new file mode 100644
index 0000000..365a7a2
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/ClusterInfoRepository.java
@@ -0,0 +1,42 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.ClusterInfoEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+public interface ClusterInfoRepository extends JpaRepository<ClusterInfoEntity, Integer> {
+
+ @Query("select c from ClusterInfoEntity c where c.address = :address "
+ + "and c.httpPort = :httpPort and c.user = :user")
+ List<ClusterInfoEntity> getByAddressAndPortAndUser(@Param("address") String address,
+ @Param("httpPort") int httpPort,
+ @Param("user") String user);
+
+ @Query("select c from ClusterInfoEntity c where c.address = :address "
+ + "and c.httpPort = :httpPort")
+ List<ClusterInfoEntity> getByAddressAndPort(@Param("address") String address,
+ @Param("httpPort") int httpPort);
+
+ @Query("select c from ClusterInfoEntity c where c.name = :name")
+ List<ClusterInfoEntity> getByName(@Param("name") String name);
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/CoreSessionRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/CoreSessionRepository.java
new file mode 100644
index 0000000..d99bdbf
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/CoreSessionRepository.java
@@ -0,0 +1,61 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.CoreSessionEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+public interface CoreSessionRepository extends JpaRepository<CoreSessionEntity, String> {
+
+ @Modifying
+ @Query("delete from CoreSessionEntity c where c.userId = :userId")
+ void deleteByUserId(@Param("userId") int userId);
+
+ @Modifying
+ @Query("delete from CoreSessionEntity c where c.userId in (:userIds)")
+ void deleteByUserId(@Param("userIds") List<Integer> userIds);
+
+ @Modifying
+ @Query("delete from CoreSessionEntity c where c.createdAt < :expireTime")
+ void deleteExpireSession(@Param("expireTime") Timestamp expireTime);
+
+ @Query("select count(c.id) from CoreSessionEntity c where c.userId = :userId and c.createdAt > :timeBefore")
+ Integer getSessionCountBeforeByUserId(@Param("userId") int userId, @Param("timeBefore") Timestamp timeBefore);
+
+ @Query("select count(c.id) from CoreSessionEntity c where c.userId = :userId")
+ Integer getSessionCountByUserId(@Param("userId") int userId);
+
+ // jpa不支持limit
+ @Modifying
+ @Query(value = "delete from core_session where core_session.user_id = :userId order by core_session.created_at limit :count",
+ nativeQuery = true)
+ void deleteSessionByUserId(@Param("userId") int userId, @Param("count") int count);
+
+ @Modifying
+ @Query(value = "delete from core_session where core_session.user_id = :userId and core_session.created_at > "
+ + ":timeBefore order by core_session.created_at limit :count", nativeQuery = true)
+ void deleteSessionBeforeByUserId(@Param("userId") int userId, @Param("timeBefore") Timestamp timeBefore,
+ @Param("count") int count);
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/CoreUserRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/CoreUserRepository.java
new file mode 100644
index 0000000..3571e7b
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/CoreUserRepository.java
@@ -0,0 +1,53 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.CoreUserEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface CoreUserRepository extends JpaRepository<CoreUserEntity, Integer> {
+ @Query("select c from CoreUserEntity c where c.email = :email")
+ List<CoreUserEntity> getByEmail(@Param("email") String email);
+
+ @Query("select c from CoreUserEntity c where c.email = :email and c.ldapAuth = :ldapAuth")
+ List<CoreUserEntity> getByEmailAndLdapAuth(@Param("email") String email, @Param("ldapAuth") boolean ldapAuth);
+
+ @Query("select c from CoreUserEntity c where c.isSuperuser = :isSuperuser and c.isActive = :isActive")
+ List<CoreUserEntity> getActiveAdminUser(@Param("isSuperuser") boolean isSuperuser,
+ @Param("isActive") boolean isActive);
+
+ @Query("select c.id from CoreUserEntity c where c.ldapAuth = false and c.id in (:userIds)")
+ List<Integer> getAllStudioUser(@Param("userIds") List<Integer> userIds);
+
+ @Query("select c.id from CoreUserEntity c where c.ldapAuth = true and c.id in (:userIds)")
+ List<Integer> getAllLdapUser(@Param("userIds") List<Integer> userIds);
+
+ @Transactional
+ @Modifying
+ @Query("delete from CoreUserEntity c where c.id in (:userIds)")
+ void deleteByUserIds(@Param("userIds") List<Integer> userIds);
+
+ @Query("select c from CoreUserEntity c where c.email = :email and c.idaasAuth = :idaasAuth")
+ List<CoreUserEntity> getByEmailAndIdaasAuth(@Param("email") String email, @Param("idaasAuth") boolean idaasAuth);
+}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java b/manager/general/src/main/java/org/apache/doris/stack/dao/LoginHistoryRepository.java
similarity index 52%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
copy to manager/general/src/main/java/org/apache/doris/stack/dao/LoginHistoryRepository.java
index b68714d..f376af6 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/LoginHistoryRepository.java
@@ -14,29 +14,20 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.exception;
-public class AgentException extends RuntimeException {
- private static final long serialVersionUID = -1L;
- private static final Integer DEAFULT_EXCEPTION_STATUS = 500;
- private int status;
+package org.apache.doris.stack.dao;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
- public AgentException(String message) {
- this(message, DEAFULT_EXCEPTION_STATUS);
- }
+import org.apache.doris.stack.entity.LoginHistoryEntity;
- public AgentException(String message, Throwable cause) {
- super(message, cause);
- }
+public interface LoginHistoryRepository extends JpaRepository<LoginHistoryEntity, Integer> {
- public AgentException(String message, int status) {
- super(message);
- this.status = status;
- }
-
- public int getStatus() {
- return status;
- }
+ @Query("select count(*) from LoginHistoryEntity c where c.userId = :userId")
+ Integer getLoginCountByUserId(@Param("userId") int userId);
+ @Query("select count(*) from LoginHistoryEntity c where c.userId = :userId and c.deviceId = :deviceId")
+ Integer getLoginCountByUserIdAndDeviceId(@Param("userId") int userId, @Param("deviceId") String deviceId);
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupMembershipRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupMembershipRepository.java
new file mode 100644
index 0000000..ffc93b1
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupMembershipRepository.java
@@ -0,0 +1,64 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.PermissionsGroupMembershipEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+import java.util.Set;
+
+public interface PermissionsGroupMembershipRepository extends
+ JpaRepository<PermissionsGroupMembershipEntity, Integer> {
+
+ @Query("select p from PermissionsGroupMembershipEntity p where p.userId = :userId")
+ List<PermissionsGroupMembershipEntity> getByUserId(@Param("userId") int userId);
+
+ @Query("select p from PermissionsGroupMembershipEntity p where p.userId = :userId and p.groupId <> :groupId")
+ List<PermissionsGroupMembershipEntity> getByUserIdNoDefaultGroup(@Param("userId") int userId,
+ @Param("groupId") int groupId);
+
+ @Query("select p from PermissionsGroupMembershipEntity p where p.userId = :userId and p.groupId = :groupId")
+ List<PermissionsGroupMembershipEntity> getByUserIdAndGroupId(@Param("userId") int userId,
+ @Param("groupId") int groupId);
+
+ @Query("select p.userId from PermissionsGroupMembershipEntity p where p.groupId = :groupId")
+ List<Integer> getUserIdsByGroupId(@Param("groupId") int groupId);
+
+ @Query("select p from PermissionsGroupMembershipEntity p where p.groupId = :groupId")
+ List<PermissionsGroupMembershipEntity> getByGroupId(@Param("groupId") int groupId);
+
+ @Query("select p.userId from PermissionsGroupMembershipEntity p where p.groupId in (:groupIds)")
+ Set<Integer> getByGroupId(@Param("groupIds") Set<Integer> groupIds);
+
+ @Modifying
+ @Query("delete from PermissionsGroupMembershipEntity p where p.groupId = :groupId")
+ void deleteByGroupId(@Param("groupId") int groupId);
+
+ @Modifying
+ @Query("delete from PermissionsGroupMembershipEntity p where p.userId = :userId")
+ void deleteByUserId(@Param("userId") int userId);
+
+ @Modifying
+ @Query("delete from PermissionsGroupMembershipEntity p where p.groupId = :groupId and p.userId = :userId")
+ void deleteByUserIdAndGroupId(@Param("groupId") int groupId, @Param("userId") int userId);
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupRoleRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupRoleRepository.java
new file mode 100644
index 0000000..b292bdd
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/PermissionsGroupRoleRepository.java
@@ -0,0 +1,56 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.PermissionsGroupRoleEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.HashSet;
+import java.util.List;
+
+public interface PermissionsGroupRoleRepository extends
+ JpaRepository<PermissionsGroupRoleEntity, Integer> {
+
+ @Query("select s from PermissionsGroupRoleEntity s where s.clusterId = :clusterId")
+ List<PermissionsGroupRoleEntity> getByClusterId(@Param("clusterId") int clusterId);
+
+ @Query("select s from PermissionsGroupRoleEntity s where s.clusterId = :clusterId and s.groupName = :groupName")
+ List<PermissionsGroupRoleEntity> getByGroupNameAndClusterId(@Param("groupName") String groupName,
+ @Param("clusterId") int clusterId);
+
+ @Query("select s.groupId from PermissionsGroupRoleEntity s where s.clusterId = :clusterId")
+ HashSet<Integer> getGroupIdByClusterId(@Param("clusterId") int clusterId);
+
+ @Query("select s from PermissionsGroupRoleEntity s where s.clusterId = :clusterId and s.role = :role")
+ List<PermissionsGroupRoleEntity> getByClusterIdAndRole(@Param("clusterId") int clusterId,
+ @Param("role") String role);
+
+ @Query("select s from PermissionsGroupRoleEntity s where s.groupName = :groupName")
+ PermissionsGroupRoleEntity getByGroupName(@Param("groupName") String groupName);
+
+ @Modifying
+ @Query("delete from PermissionsGroupRoleEntity s where s.clusterId = :clusterId")
+ void deleteByClusterId(@Param("clusterId") int clusterId);
+
+ @Modifying
+ @Query("delete from PermissionsGroupRoleEntity s where s.groupName = :groupName")
+ void deleteByGroupName(@Param("groupName") String groupName);
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/SettingRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/SettingRepository.java
new file mode 100644
index 0000000..fb45d69
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/SettingRepository.java
@@ -0,0 +1,41 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.SettingEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface SettingRepository extends JpaRepository<SettingEntity, String> {
+
+ @Query("select s from SettingEntity s where s.key in (:keys)")
+ List<SettingEntity> getSettingByKeys(@Param("keys") List<String> keys);
+
+ @Query("select s.value from SettingEntity s where s.key like ?1%")
+ List<String> getAllByPrefix(String prefix);
+
+ @Transactional
+ @Modifying
+ @Query("delete from SettingEntity s where s.key like ?1%")
+ void deleteAllByPrefix(String prefix);
+}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java b/manager/general/src/main/java/org/apache/doris/stack/dao/StudioSettingRepository.java
similarity index 55%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
copy to manager/general/src/main/java/org/apache/doris/stack/dao/StudioSettingRepository.java
index b68714d..4743be0 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/exception/AgentException.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/StudioSettingRepository.java
@@ -14,29 +14,20 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.exception;
-public class AgentException extends RuntimeException {
- private static final long serialVersionUID = -1L;
- private static final Integer DEAFULT_EXCEPTION_STATUS = 500;
- private int status;
+package org.apache.doris.stack.dao;
+import org.apache.doris.stack.entity.StudioSettingEntity;
+import org.apache.doris.stack.entity.StudioSettingEntityPk;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
- public AgentException(String message) {
- this(message, DEAFULT_EXCEPTION_STATUS);
- }
+public interface StudioSettingRepository extends JpaRepository<StudioSettingEntity, StudioSettingEntityPk> {
- public AgentException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AgentException(String message, int status) {
- super(message);
- this.status = status;
- }
-
- public int getStatus() {
- return status;
- }
+ @Modifying
+ @Query("delete from StudioSettingEntity s where s.clusterId = :clusterId")
+ void deleteByClusterId(@Param("clusterId") int clusterId);
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/dao/SuperUserRepository.java b/manager/general/src/main/java/org/apache/doris/stack/dao/SuperUserRepository.java
new file mode 100644
index 0000000..db2017a
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/dao/SuperUserRepository.java
@@ -0,0 +1,46 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.dao;
+
+import org.apache.doris.stack.entity.SuperUserEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Set;
+
+public interface SuperUserRepository extends JpaRepository<SuperUserEntity, String> {
+
+ @Query("select s from SuperUserEntity s where s.key like ?1%")
+ Set<SuperUserEntity> getAllByPrefix(@Param("prefix") String prefix);
+
+ @Transactional
+ @Modifying
+ @Query("delete from SuperUserEntity s where s.key like ?1%")
+ void deleteByPrefix(@Param("prefix") String prefix);
+
+ @Query("select s from SuperUserEntity s where s.value = :value")
+ SuperUserEntity getByValue(@Param("value") String value);
+
+ @Transactional
+ @Modifying
+ @Query("delete from SuperUserEntity s where s.value = :value")
+ void deleteByValue(@Param("value") String value);
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/ActivityEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/ActivityEntity.java
new file mode 100644
index 0000000..aa9e7c7
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/ActivityEntity.java
@@ -0,0 +1,140 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import com.alibaba.fastjson.JSON;
+import org.apache.doris.stack.model.activity.ActivityInfoResp;
+import org.apache.doris.stack.model.activity.ActivityViewInfoResp;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "activity")
+@Data
+@NoArgsConstructor
+public class ActivityEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ @Column(length = 32, nullable = false)
+ private String topic;
+
+ @Column(name = "timestamp", nullable = false)
+ private Timestamp timestamp;
+
+ @Column(length = 16)
+ private String model;
+
+ @Column(name = "model_id")
+ private Integer modelId;
+
+ @Column(name = "user_id")
+ private Integer userId;
+
+ @Column(name = "database_id")
+ private Integer databaseId;
+
+ @Column(name = "table_id")
+ private Integer tableId;
+
+ @Column(name = "custom_id", length = 48)
+ private String customId;
+
+ @Column(columnDefinition = "TEXT", nullable = false)
+ private String details;
+
+ public ActivityEntity(String topic, String model, String details) {
+ this.timestamp = new Timestamp(System.currentTimeMillis());
+
+ this.topic = topic;
+ this.model = model;
+ this.details = details;
+ }
+
+ public ActivityEntity(String topic, String model, String details, int modelId, int userId) {
+ this.timestamp = new Timestamp(System.currentTimeMillis());
+
+ this.topic = topic;
+ this.model = model;
+ this.modelId = modelId;
+ this.details = details;
+ this.userId = userId;
+ }
+
+ public ActivityEntity(String topic, String model, String details, int modelId, int userId,
+ int databaseId, int tableId) {
+ this.timestamp = new Timestamp(System.currentTimeMillis());
+
+ this.topic = topic;
+ this.model = model;
+ this.modelId = modelId;
+ this.details = details;
+ this.userId = userId;
+ this.databaseId = databaseId;
+ this.tableId = tableId;
+ }
+
+ public ActivityInfoResp transToModel() {
+ ActivityInfoResp resp = new ActivityInfoResp();
+ resp.setId(this.id);
+ resp.setTableId(this.tableId);
+ resp.setDatabaseId(this.databaseId);
+ resp.setTopic(this.topic);
+ resp.setCustomId(this.customId);
+ resp.setDetails(JSON.parseObject(this.details, ActivityInfoResp.Details.class));
+ resp.setModel(this.model);
+ resp.setModelId(this.modelId);
+ resp.setUserId(this.userId);
+ resp.setTimestamp(this.timestamp);
+ return resp;
+ }
+
+ public ActivityViewInfoResp transToViewModel() {
+ ActivityViewInfoResp resp = new ActivityViewInfoResp();
+ resp.setModel(this.model);
+ resp.setModelId(this.modelId);
+ resp.setUserId(this.userId);
+ resp.setMaxTs(this.timestamp);
+ return resp;
+ }
+
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ public static class ModelActivityEntity {
+ private int id;
+
+ private String model;
+
+ private Integer modelId;
+
+ private Integer userId;
+ }
+
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/ClusterInfoEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/ClusterInfoEntity.java
new file mode 100644
index 0000000..974a99f
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/ClusterInfoEntity.java
@@ -0,0 +1,138 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import org.apache.doris.stack.model.request.space.ClusterCreateReq;
+import org.apache.doris.stack.model.request.space.ClusterType;
+import org.apache.doris.stack.model.response.space.UserSpaceInfo;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.sql.Timestamp;
+
+/**
+ * @Description:Doris cluster space information
+ */
+@Entity
+@Table(name = "cluster_info")
+@Data
+@NoArgsConstructor
+public class ClusterInfoEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ @Column(length = 100, nullable = false)
+ private String name;
+
+ private String address;
+
+ private int httpPort;
+
+ private int queryPort;
+
+ /**
+ * Admin user of Doris cluster
+ */
+ @Column(name = "[user]", length = 100)
+ private String user;
+
+ /**
+ * Doris user password
+ * TODO:The subsequent storage shall be encrypted to prevent the leakage of password information
+ */
+ @Column(length = 100)
+ private String passwd;
+
+ @Column(length = 50)
+ private String sessionId;
+
+ private Timestamp createTime;
+
+ private Timestamp updateTime;
+
+ /**
+ * Broker name information for file import
+ */
+ private String brokerName;
+
+ /**
+ * Description information
+ */
+ private String description;
+
+ private int adminUserId;
+
+ private String adminUserMail;
+
+ private int adminGroupId;
+
+ private int allUserGroupId;
+
+ private int collectionId;
+
+ private boolean isActive = true;
+
+ /**
+ * Engine type(Doris/Mysql/Dae)
+ */
+ private String type;
+
+ @Column(name = "timezone", length = 254)
+ private String timezone;
+
+ private boolean managerEnable;
+
+ public void updateByClusterInfo(ClusterCreateReq createReq) {
+ this.address = createReq.getAddress();
+ this.httpPort = createReq.getHttpPort();
+ this.queryPort = createReq.getQueryPort();
+ this.user = createReq.getUser();
+ this.passwd = createReq.getPasswd();
+ this.updateTime = new Timestamp(System.currentTimeMillis());
+ if (createReq.getType() == null) {
+ this.type = ClusterType.Doris.name();
+ } else {
+ this.type = createReq.getType().name();
+ }
+ }
+
+ public UserSpaceInfo transToModel() {
+ UserSpaceInfo userSpaceInfo = new UserSpaceInfo();
+ userSpaceInfo.setId(this.id);
+ userSpaceInfo.setName(this.name);
+ userSpaceInfo.setDescription(this.description);
+ userSpaceInfo.setPaloAddress(this.address);
+ userSpaceInfo.setHttpPort(this.httpPort);
+ userSpaceInfo.setQueryPort(this.queryPort);
+ userSpaceInfo.setPaloAdminUser(this.user);
+ userSpaceInfo.setUpdateTime(this.updateTime);
+ userSpaceInfo.setCreateTime(this.createTime);
+ userSpaceInfo.setAllUserGroupId(this.allUserGroupId);
+ userSpaceInfo.setAdminGroupId(this.adminGroupId);
+ userSpaceInfo.setPublicCollectionId(this.collectionId);
+ return userSpaceInfo;
+ }
+}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/ServerDao.java b/manager/general/src/main/java/org/apache/doris/stack/entity/CoreSessionEntity.java
similarity index 53%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/ServerDao.java
copy to manager/general/src/main/java/org/apache/doris/stack/entity/CoreSessionEntity.java
index 38e9de9..daeb83d 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/dao/ServerDao.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/CoreSessionEntity.java
@@ -14,31 +14,38 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.dao;
-import org.apache.doris.manager.server.entity.AgentEntity;
-import org.apache.doris.manager.server.entity.AgentRoleEntity;
+package org.apache.doris.stack.entity;
-import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
-/**
- * server dao
- **/
-public interface ServerDao {
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.sql.Timestamp;
- List<AgentEntity> queryAgentNodes(List<String> hosts);
+@Entity
+@Table(name = "core_session")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CoreSessionEntity {
- AgentEntity agentInfo(String host, Integer port);
+ @Id
+ @Column(length = 254)
+ private String id;
- int refreshAgentStatus(String host, Integer port);
+ @Column(name = "user_id", nullable = false)
+ private int userId;
- int registerAgent(String host, Integer port);
+ @Column(name = "created_at", nullable = false)
+ private Timestamp createdAt;
- int updateBatchAgentStatus(List<AgentEntity> agents);
+ @Column(columnDefinition = "TEXT", name = "anti_csrf_token")
+ private String antiCsrfToken;
- int insertAgentRole(List<AgentRoleEntity> agentRoles);
-
- String agentRole(String host);
-
- List<AgentRoleEntity> agentRoles();
}
+
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/CoreUserEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/CoreUserEntity.java
new file mode 100644
index 0000000..c202985
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/CoreUserEntity.java
@@ -0,0 +1,211 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import org.apache.doris.stack.model.ldap.LdapUserInfo;
+import org.apache.doris.stack.model.request.user.UserAddReq;
+import org.apache.doris.stack.model.request.space.UserSpaceCreateReq;
+import org.apache.doris.stack.model.response.user.UserInfo;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "core_user")
+@Data
+@NoArgsConstructor
+public class CoreUserEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ @Column(length = 254, nullable = false)
+ private String email;
+
+ @Column(length = 254, name = "first_name", nullable = false)
+ private String firstName;
+
+ @Column(length = 254, name = "last_name", nullable = false)
+ private String lastName;
+
+ @Column(length = 254, name = "password", nullable = false)
+ private String password;
+
+ @Column(length = 254, name = "password_salt", nullable = false)
+ private String passwordSalt;
+
+ @Column(name = "date_joined", nullable = false)
+ private Timestamp dateJoined;
+
+ @Column(name = "last_login")
+ private Timestamp lastLogin;
+
+ @Column(name = "is_superuser", nullable = false)
+ private boolean isSuperuser;
+
+ @Column(name = "is_active", nullable = false)
+ private boolean isActive;
+
+ @Column(length = 254, name = "reset_token")
+ private String resetToken;
+
+ @Column(name = "reset_triggered")
+ private Long resetTriggered;
+
+ @Column(name = "is_qbnewb", nullable = false)
+ private boolean isQbnewb;
+
+ @Column(name = "google_auth", nullable = false)
+ private boolean googleAuth;
+
+ @Column(name = "ldap_auth", nullable = false)
+ private boolean ldapAuth;
+
+ @Column(name = "idaas_auth", nullable = false)
+ private boolean idaasAuth;
+
+ @Column(columnDefinition = "TEXT", name = "login_attributes")
+ private String loginAttributes;
+
+ @Column(name = "updated_at")
+ private Timestamp updatedAt;
+
+ @Column(length = 254, name = "sso_source")
+ private String ssoSource;
+
+ @Column(length = 5, name = "locale")
+ private String locale;
+
+ public CoreUserEntity(UserSpaceCreateReq.UserAdminInfo usInfo) {
+ this.email = usInfo.getEmail();
+ this.firstName = usInfo.getName();
+ this.lastName = "palo";
+ this.dateJoined = new Timestamp(System.currentTimeMillis());
+ this.isSuperuser = true;
+ this.isActive = true;
+ this.isQbnewb = true;
+ this.updatedAt = new Timestamp(System.currentTimeMillis());
+ this.password = "";
+ this.passwordSalt = "";
+ }
+
+ public CoreUserEntity(UserSpaceCreateReq.UserAdminInfo usInfo, LdapUserInfo ldapUserInfo) {
+ this.email = usInfo.getEmail();
+ this.firstName = (ldapUserInfo.getLastName() == null ? "" : ldapUserInfo.getLastName())
+ + (ldapUserInfo.getFirstName() == null ? "" : ldapUserInfo.getFirstName());
+ this.lastName = "palo";
+ this.dateJoined = new Timestamp(System.currentTimeMillis());
+ this.isSuperuser = true;
+ this.isActive = true;
+ this.isQbnewb = true;
+ this.updatedAt = new Timestamp(System.currentTimeMillis());
+ this.password = "";
+ this.passwordSalt = "";
+ }
+
+ public CoreUserEntity(UserAddReq userAddReq) {
+ this.email = userAddReq.getEmail();
+ this.firstName = userAddReq.getName();
+ this.lastName = "palo";
+ this.dateJoined = new Timestamp(System.currentTimeMillis());
+ this.isSuperuser = false;
+ this.isActive = true;
+ this.isQbnewb = true;
+ this.updatedAt = new Timestamp(System.currentTimeMillis());
+ }
+
+ public CoreUserEntity(UserAddReq userAddReq, LdapUserInfo userInfo) {
+ this.email = userAddReq.getEmail();
+ this.firstName = userInfo.getLastName() + userInfo.getFirstName();
+ this.lastName = "palo";
+ this.dateJoined = new Timestamp(System.currentTimeMillis());
+ this.isSuperuser = false;
+ this.isActive = true;
+ this.isQbnewb = true;
+ this.updatedAt = new Timestamp(System.currentTimeMillis());
+ this.password = userInfo.getPassword();
+ this.ldapAuth = true;
+ }
+
+ /**
+ * @param userEntity
+ */
+ public CoreUserEntity(CoreUserEntity userEntity) {
+ this.id = userEntity.getId();
+ this.email = userEntity.getEmail();
+ this.firstName = userEntity.getFirstName();
+ this.lastName = userEntity.getLastName();
+ this.password = userEntity.getPassword();
+ this.passwordSalt = userEntity.getPasswordSalt();
+ this.dateJoined = new Timestamp(System.currentTimeMillis());
+ this.lastLogin = userEntity.getLastLogin();
+ this.isSuperuser = false;
+ this.isActive = true;
+ this.resetToken = userEntity.getResetToken();
+ this.resetTriggered = userEntity.getResetTriggered();
+ this.isQbnewb = true;
+ this.googleAuth = false;
+ this.ldapAuth = true;
+ this.loginAttributes = userEntity.getLoginAttributes();
+ this.updatedAt = new Timestamp(System.currentTimeMillis());
+ this.ssoSource = userEntity.getSsoSource();
+ this.locale = userEntity.getLocale();
+ }
+
+ public UserInfo castToUserInfo() {
+ UserInfo userInfo = new UserInfo();
+ userInfo.setEmail(this.email);
+ userInfo.setLdapAuth(this.ldapAuth);
+ userInfo.setName(this.firstName);
+ userInfo.setLocale(this.locale);
+ userInfo.setLastLogin(this.lastLogin);
+ userInfo.setActive(this.isActive);
+ userInfo.setQbnewb(this.isQbnewb);
+ userInfo.setUpdatedAt(this.updatedAt);
+ userInfo.setAdmin(this.isSuperuser);
+ userInfo.setLoginAttributes(this.loginAttributes);
+ userInfo.setId(this.id);
+ userInfo.setDateJoined(this.dateJoined);
+ userInfo.setCommonName(this.firstName);
+ userInfo.setGoogleAuth(this.googleAuth);
+ return userInfo;
+ }
+
+ public UserInfo castToSimpleUserInfo() {
+ UserInfo userInfo = new UserInfo();
+ userInfo.setName(this.firstName);
+ userInfo.setId(this.id);
+ return userInfo;
+ }
+
+ public boolean getLdapAuth() {
+ return ldapAuth;
+ }
+
+ public void setLdapAuth(boolean ldapAuth) {
+ this.ldapAuth = ldapAuth;
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/LoginHistoryEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/LoginHistoryEntity.java
new file mode 100644
index 0000000..adda87c
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/LoginHistoryEntity.java
@@ -0,0 +1,71 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "login_history")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class LoginHistoryEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ @Column(name = "timestamp", nullable = false)
+ private Timestamp timestamp;
+
+ @Column(name = "user_id", nullable = false)
+ private int userId;
+
+ @Column(length = 254, name = "session_id", nullable = false)
+ private String sessionId;
+
+ @Column(length = 254, name = "device_id", nullable = false)
+ private String deviceId;
+
+ @Column(length = 254, name = "device_description", nullable = false)
+ private String deviceDescription;
+
+ @Column(length = 254, name = "ip_address", nullable = false)
+ private String ipAddress;
+
+ public LoginHistoryEntity(Timestamp timestamp, int userId, String sessionId, String deviceId,
+ String deviceDescription, String ipAddress) {
+ this.timestamp = timestamp;
+ this.userId = userId;
+ this.sessionId = sessionId;
+ this.deviceId = deviceId;
+ this.deviceDescription = deviceDescription;
+ this.ipAddress = ipAddress;
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupMembershipEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupMembershipEntity.java
new file mode 100644
index 0000000..f68e8d1
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupMembershipEntity.java
@@ -0,0 +1,59 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import org.apache.doris.stack.model.response.user.UserGroupMembership;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @Description:Mapping relationship table between permission group and user
+ */
+@Entity
+@Table(name = "permissions_group_membership")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PermissionsGroupMembershipEntity {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ @Column(name = "user_id", nullable = false)
+ private int userId;
+
+ @Column(name = "group_id", nullable = false)
+ private int groupId;
+
+ public PermissionsGroupMembershipEntity(int userId, int groupId) {
+ this.userId = userId;
+ this.groupId = groupId;
+ }
+
+ public UserGroupMembership castToModel() {
+ return new UserGroupMembership(this.id, this.groupId, this.userId);
+ }
+}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupRoleEntity.java b/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupRoleEntity.java
new file mode 100644
index 0000000..4583fd2
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/PermissionsGroupRoleEntity.java
@@ -0,0 +1,67 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @Description:
+ */
+@Entity
+@Table(name = "permissions_group_role")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PermissionsGroupRoleEntity {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int groupId;
+
+ private String groupName;
+
+ private String role;
+
+ private int clusterId;
+
+ private String paloUserName;
+
+ private String password;
+
+ public PermissionsGroupRoleEntity(String groupName, String role, int clusterId) {
+ this.groupName = groupName;
+ this.role = role;
+ this.clusterId = clusterId;
+ }
+
+ public PermissionsGroupRoleEntity(String groupName, String role, int clusterId,
+ String paloUserName, String password) {
+ this.groupName = groupName;
+ this.role = role;
+ this.clusterId = clusterId;
+ this.paloUserName = paloUserName;
+ this.password = password;
+ }
+}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java b/manager/general/src/main/java/org/apache/doris/stack/entity/SettingEntity.java
similarity index 57%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
copy to manager/general/src/main/java/org/apache/doris/stack/entity/SettingEntity.java
index b5942f2..f3bf75a 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/SettingEntity.java
@@ -14,27 +14,32 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class AgentCommon {
+package org.apache.doris.stack.entity;
- private String host;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
- private Integer port;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
+@Entity
+@Table(name = "setting")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SettingEntity {
+ @Id
+ @Column(name = "[key]", columnDefinition = "VARCHAR(254)")
+ private String key;
- public Integer getPort() {
- return port;
- }
+ @Column(name = "value", columnDefinition = "TEXT")
+ private String value;
- public void setPort(Integer port) {
- this.port = port;
+ public SettingEntity(String key) {
+ this.key = key;
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java b/manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntity.java
similarity index 53%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java
copy to manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntity.java
index d5dd206..173e7a9 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ITaskLog.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntity.java
@@ -14,23 +14,35 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import javafx.util.Pair;
+package org.apache.doris.stack.entity;
-import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
-public interface ITaskLog {
- Pair<Integer, List<String>> stdLog(int offset, int size);
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
- List<String> errLog(int offset, int size);
+@Entity
+@Table(name = "studio_setting")
+@Data
+@IdClass(StudioSettingEntityPk.class)
+@NoArgsConstructor
+@AllArgsConstructor
+public class StudioSettingEntity {
- void appendStdLog(String log);
+ @Id
+ @Column(name = "[key]", columnDefinition = "VARCHAR(254)")
+ private String key;
- void appendErrLog(String log);
+ @Id
+ @Column(name = "cluster_id", nullable = false)
+ private int clusterId;
- List<String> allStdLog();
-
- List<String> allErrLog();
+ @Column(name = "value", columnDefinition = "TEXT")
+ private String value;
}
-
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntityPk.java
similarity index 71%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntityPk.java
index 6488f61..41b3c73 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/StudioSettingEntityPk.java
@@ -14,16 +14,21 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.entity;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
- public abstract void doHandle(Task task);
+import java.io.Serializable;
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class StudioSettingEntityPk implements Serializable {
+
+ private String key;
+
+ private int clusterId;
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/entity/SuperUserEntity.java
similarity index 57%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/entity/SuperUserEntity.java
index 9303ca3..d34c18f 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/AbsAsyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/entity/SuperUserEntity.java
@@ -14,25 +14,31 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.concurrent.ExecutorService;
+package org.apache.doris.stack.entity;
-public abstract class AbsAsyncTaskHandler extends TaskHandler {
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
- @Override
- public void doHandle(Task task) {
- task.getTaskResult().setTaskState(TaskState.QUEUED);
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
- TaskContext.register(task);
- getExecutorService().submit(new Runnable() {
- @Override
- public void run() {
- task.executeTask();
- }
- });
- }
-
- public abstract ExecutorService getExecutorService();
+/**
+ * @Description:Super administrator user information
+ */
+@Entity
+@Table(name = "super_user")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SuperUserEntity {
+ @Id
+ @Column(name = "[key]", columnDefinition = "VARCHAR(254)")
+ private String key;
+ @Column(name = "value", columnDefinition = "TEXT")
+ private String value;
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/AuthorizationException.java
similarity index 72%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/AuthorizationException.java
index 6488f61..3dc1b81 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/AuthorizationException.java
@@ -14,16 +14,17 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+/**
+ * @Description:User's cookie authentication failed exception
+ */
+public class AuthorizationException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "用户认证失败,请重新登陆";
+ public AuthorizationException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/BadRequestException.java
similarity index 82%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/BadRequestException.java
index 69aaa26..8a2131b 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/BadRequestException.java
@@ -14,12 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class BadRequestException extends RuntimeException {
+
+ public BadRequestException(String msg) {
+ super(msg);
}
+
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/DorisConnectionException.java
similarity index 75%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/DorisConnectionException.java
index 91b63e6..2cc69d5 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/DorisConnectionException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class DorisConnectionException extends Exception {
+
+ public static final String MESSAGE = "引擎连接信息有误,请检查后重新输入";
- public void setOffset(int offset) {
- this.offset = offset;
+ public DorisConnectionException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/DorisSpaceDuplicatedException.java
similarity index 75%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/DorisSpaceDuplicatedException.java
index 6488f61..d949a1d 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/DorisSpaceDuplicatedException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+public class DorisSpaceDuplicatedException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "Doris集群已经绑定了空间,请重新输入";
+ public DorisSpaceDuplicatedException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/EmailSendException.java
similarity index 71%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/EmailSendException.java
index 6488f61..b5a52d5 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/EmailSendException.java
@@ -14,16 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+/**
+ * @Description:Mail sending failed exception
+ */
+public class EmailSendException extends Exception {
+
+ public static final String MESSAGE = "邮件发送失败,请检查邮件服务配置或邮箱地址";
- public abstract void doHandle(Task task);
+ public EmailSendException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java b/manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUnknownHostException.java
similarity index 75%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUnknownHostException.java
index 5700811..284e20c 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskDesc.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUnknownHostException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public abstract class TaskDesc {
- private String taskName;
+package org.apache.doris.stack.exception;
- public String getTaskName() {
- return taskName;
- }
+public class HdfsUnknownHostException extends Exception {
+
+ public static final String MESSAGE = "HDFS集群主机链接失败,请检查后重新输入";
- public void setTaskName(String taskName) {
- this.taskName = taskName;
+ public HdfsUnknownHostException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUrlException.java
similarity index 77%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUrlException.java
index 69aaa26..c3c7a88 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/HdfsUrlException.java
@@ -14,12 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class HdfsUrlException extends Exception {
+
+ public static final String MESSAGE = "HDFS集群URL错误,请检查后重新输入";
+
+ public HdfsUrlException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/IdaasConnectionException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/IdaasConnectionException.java
index 91b63e6..7568e1a 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/IdaasConnectionException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class IdaasConnectionException extends Exception {
+
+ public static final String MESSAGE = "Idaas配置信息有误,请修改后重试";
- public void setOffset(int offset) {
- this.offset = offset;
+ public IdaasConnectionException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/IdaasNotExistException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/IdaasNotExistException.java
index 91b63e6..0516772 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/IdaasNotExistException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class IdaasNotExistException extends Exception {
+
+ public static final String MESSAGE = "缺少IDAAS配置信息,请补全后重试";
- public void setOffset(int offset) {
- this.offset = offset;
+ public IdaasNotExistException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/InputDataException.java
similarity index 77%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/InputDataException.java
index 69aaa26..eb27a61 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/InputDataException.java
@@ -14,12 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class InputDataException extends Exception {
+
+ public static final String MESSAGE = "输入内容不存在,请重新输入";
+
+ public InputDataException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/InputFormatException.java
similarity index 77%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/InputFormatException.java
index 69aaa26..2c33275 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/InputFormatException.java
@@ -14,12 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class InputFormatException extends Exception {
+
+ public static final String MESSAGE = "输入格式错误,请重新输入";
+
+ public InputFormatException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/InvalidDataException.java
similarity index 75%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/InvalidDataException.java
index 91b63e6..e649068 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/InvalidDataException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class InvalidDataException extends Exception {
+
+ public static final String MESSAGE = "不合法数据实体,请重试或者联系技术人员";
- public void setOffset(int offset) {
- this.offset = offset;
+ public InvalidDataException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/LdapConnectionException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/LdapConnectionException.java
index 91b63e6..f4b6190 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/LdapConnectionException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class LdapConnectionException extends Exception {
+
+ public static final String MESSAGE = "LDAP配置信息有误,请修改后重试";
- public void setOffset(int offset) {
- this.offset = offset;
+ public LdapConnectionException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/LdapNotExistException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/LdapNotExistException.java
index 91b63e6..0218950 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/LdapNotExistException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class LdapNotExistException extends Exception {
+
+ public static final String MESSAGE = "缺少LDAP配置信息,请补全后重试";
- public void setOffset(int offset) {
- this.offset = offset;
+ public LdapNotExistException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/MetaDataSyncException.java
similarity index 80%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/MetaDataSyncException.java
index 69aaa26..485a0be 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/MetaDataSyncException.java
@@ -14,12 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class MetaDataSyncException extends Exception {
+
+ public MetaDataSyncException(String msg) {
+ super("同步引擎元数据错误:" + msg);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/NameDuplicatedException.java
similarity index 77%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/NameDuplicatedException.java
index 69aaa26..34989b4 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/NameDuplicatedException.java
@@ -14,12 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class NameDuplicatedException extends Exception {
+
+ public static final String MESSAGE = "名称重复,请重新输入";
+
+ public NameDuplicatedException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/NoAdminPermissionException.java
similarity index 74%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/NoAdminPermissionException.java
index 6488f61..844ff82 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/NoAdminPermissionException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+public class NoAdminPermissionException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "抱歉,您没有操作权限,可联系管理员进行授权";
+ public NoAdminPermissionException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/NoPermissionException.java
similarity index 75%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/NoPermissionException.java
index 6488f61..fbdf205 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/NoPermissionException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+public class NoPermissionException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "抱歉,您没有操作权限,可联系管理员进行授权";
+ public NoPermissionException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/PaloRequestException.java
similarity index 80%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/PaloRequestException.java
index 69aaa26..f062e1d 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/PaloRequestException.java
@@ -14,12 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class PaloRequestException extends Exception {
+
+ public PaloRequestException(String msg) {
+ super("Doris集群访问错误:" + msg);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/PasswordFormatException.java
similarity index 76%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/PasswordFormatException.java
index 69aaa26..5bd8840 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/PasswordFormatException.java
@@ -14,12 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class PasswordFormatException extends Exception {
+
+ public static final String MESSAGE = "密码强度太低,请重新输入";
+
+ public PasswordFormatException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/RequestFieldNullException.java
similarity index 70%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/RequestFieldNullException.java
index 6488f61..ebb8bca 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/RequestFieldNullException.java
@@ -14,16 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+/**
+ * @Description:There is a problem with the request body
+ */
+public class RequestFieldNullException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "请求信息异常,请刷新后重试或联系技术人员";
+ public RequestFieldNullException() {
+ super(MESSAGE);
+ }
}
+
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordException.java
similarity index 76%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordException.java
index 69aaa26..af03184 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordException.java
@@ -14,12 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class ResetPasswordException extends Exception {
+
+ public static final String MESSAGE = "新旧密码一样,请重新输入";
+
+ public ResetPasswordException() {
+ super(MESSAGE);
}
+
}
+
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordTokenException.java
similarity index 73%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordTokenException.java
index 6488f61..17f25a8 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/ResetPasswordTokenException.java
@@ -14,16 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+/**
+ * @Description:
+ */
+public class ResetPasswordTokenException extends Exception {
+
+ public static final String MESSAGE = "链接失效,请联系管理员重新发送邮件";
- public abstract void doHandle(Task task);
+ public ResetPasswordTokenException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java b/manager/general/src/main/java/org/apache/doris/stack/exception/SqlSyntaxException.java
similarity index 74%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/SqlSyntaxException.java
index b10a877..05d9aa1 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/ScriptTaskDesc.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/SqlSyntaxException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class ScriptTaskDesc extends TaskDesc {
- private String scriptCmd;
+package org.apache.doris.stack.exception;
- public String getScriptCmd() {
- return scriptCmd;
+public class SqlSyntaxException extends Exception {
+ public SqlSyntaxException(String msg) {
+ super("SqlSyntaxException:" + msg);
}
- public void setScriptCmd(String scriptCmd) {
- this.scriptCmd = scriptCmd;
+ public SqlSyntaxException(String msg, Throwable t) {
+ super("SqlSyntaxException:" + msg, t);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/StudioInitException.java
similarity index 75%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/StudioInitException.java
index 91b63e6..47ff357 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/StudioInitException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class StudioInitException extends Exception {
+
+ public static final String MESSAGE = "初始化已完成,请刷新后重试或联系技术人员";
- public void setOffset(int offset) {
- this.offset = offset;
+ public StudioInitException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/StudioNotInitException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/StudioNotInitException.java
index 91b63e6..47637e3 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/StudioNotInitException.java
@@ -14,16 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class StudioNotInitException extends Exception {
+
+ public static final String MESSAGE = "初始化未完成,请完成后再操作";
- public void setOffset(int offset) {
- this.offset = offset;
+ public StudioNotInitException() {
+ super(MESSAGE);
}
+
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UnknownException.java
similarity index 81%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UnknownException.java
index 69aaa26..91df0f7 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UnknownException.java
@@ -14,12 +14,12 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class UnknownException extends Exception {
+
+ public UnknownException(String message) {
+ super("未知异常类型:" + message);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserDisabledException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserDisabledException.java
index 91b63e6..ed5ce87 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserDisabledException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class UserDisabledException extends Exception {
+
+ public static final String MESSAGE = "用户名已经被禁用,请联系管理员";
- public void setOffset(int offset) {
- this.offset = offset;
+ public UserDisabledException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserEmailDuplicatedException.java
similarity index 75%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserEmailDuplicatedException.java
index 91b63e6..9f4ede1 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserEmailDuplicatedException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class UserEmailDuplicatedException extends Exception {
+
+ public static final String MESSAGE = "账号已被使用,请修改后重试";
- public void setOffset(int offset) {
- this.offset = offset;
+ public UserEmailDuplicatedException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserFailedLoginTooManyException.java
similarity index 75%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserFailedLoginTooManyException.java
index 6488f61..24f0834 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserFailedLoginTooManyException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+public class UserFailedLoginTooManyException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "登录失败次数过多,五分钟后重试";
+ public UserFailedLoginTooManyException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginException.java
similarity index 76%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginException.java
index 69aaa26..88d8b16 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/SyncTaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginException.java
@@ -14,12 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-public class SyncTaskHandler extends TaskHandler {
+package org.apache.doris.stack.exception;
- @Override
- public void doHandle(Task task) {
- task.executeTask();
+public class UserLoginException extends Exception {
+
+ public static final String MESSAGE = "用户名或者密码错误,请重新输入";
+
+ public UserLoginException() {
+ super(MESSAGE);
}
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginTooManyException.java
similarity index 74%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginTooManyException.java
index 6488f61..3f6eeb7 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserLoginTooManyException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.exception;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+public class UserLoginTooManyException extends Exception {
- public abstract void doHandle(Task task);
+ public static final String MESSAGE = "该帐号短时间内登录次数过多,请五分钟后重试";
+ public UserLoginTooManyException() {
+ super(MESSAGE);
+ }
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/exception/UserNotExistException.java
similarity index 76%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
copy to manager/general/src/main/java/org/apache/doris/stack/exception/UserNotExistException.java
index 91b63e6..46f366c 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/exception/UserNotExistException.java
@@ -14,16 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.exception;
- public int getOffset() {
- return offset;
- }
+public class UserNotExistException extends Exception {
+
+ public static final String MESSAGE = "用户名或者密码错误,请重新输入";
- public void setOffset(int offset) {
- this.offset = offset;
+ public UserNotExistException() {
+ super(MESSAGE);
}
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityInfoResp.java b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityInfoResp.java
new file mode 100644
index 0000000..5f94721
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityInfoResp.java
@@ -0,0 +1,177 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.model.activity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.apache.doris.stack.model.meta.DataBaseResp;
+import org.apache.doris.stack.model.meta.TableResp;
+import org.apache.doris.stack.model.response.user.UserInfo;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ActivityInfoResp {
+
+ private int id;
+
+ private Integer tableId;
+
+ private TableResp table;
+
+ private Integer databaseId;
+
+ private DataBaseResp database;
+
+ private boolean modelExists;
+
+ private String topic;
+
+ private String customId;
+
+ private Details details;
+
+ private Integer modelId;
+
+ private String model;
+
+ private Integer userId;
+
+ private UserInfo user;
+
+ private Timestamp timestamp;
+
+ @JSONField(name = "table_id")
+ @JsonProperty("table_id")
+ public Integer getTableId() {
+ return tableId;
+ }
+
+ @JSONField(name = "table_id")
+ @JsonProperty("table_id")
+ public void setTableId(Integer tableId) {
+ this.tableId = tableId;
+ }
+
+ @JSONField(name = "database_id")
+ @JsonProperty("database_id")
+ public Integer getDatabaseId() {
+ return databaseId;
+ }
+
+ @JSONField(name = "database_id")
+ @JsonProperty("database_id")
+ public void setDatabaseId(Integer databaseId) {
+ this.databaseId = databaseId;
+ }
+
+ @JSONField(name = "model_exists")
+ @JsonProperty("model_exists")
+ public boolean isModelExists() {
+ return modelExists;
+ }
+
+ @JSONField(name = "model_exists")
+ @JsonProperty("model_exists")
+ public void setModelExists(boolean modelExists) {
+ this.modelExists = modelExists;
+ }
+
+ @JSONField(name = "custom_id")
+ @JsonProperty("custom_id")
+ public String getCustomId() {
+ return customId;
+ }
+
+ @JSONField(name = "custom_id")
+ @JsonProperty("custom_id")
+ public void setCustomId(String customId) {
+ this.customId = customId;
+ }
+
+ @JSONField(name = "model_id")
+ @JsonProperty("model_id")
+ public Integer getModelId() {
+ return modelId;
+ }
+
+ @JSONField(name = "model_id")
+ @JsonProperty("model_id")
+ public void setModelId(Integer modelId) {
+ this.modelId = modelId;
+ }
+
+ @JSONField(name = "user_id")
+ @JsonProperty("user_id")
+ public Integer getUserId() {
+ return userId;
+ }
+
+ @JSONField(name = "user_id")
+ @JsonProperty("user_id")
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ @Data
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public static class Details {
+ private String name;
+
+ private String description;
+
+ private List<Dashcard> dashcards;
+ }
+
+ @Data
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public static class Dashcard {
+ private String name;
+
+ private String description;
+
+ private int id;
+
+ private int cardId;
+
+ private boolean exists;
+
+ @JSONField(name = "card_id")
+ @JsonProperty("card_id")
+ public int getCardId() {
+ return cardId;
+ }
+
+ @JSONField(name = "card_id")
+ @JsonProperty("card_id")
+ public void setCardId(int cardId) {
+ this.cardId = cardId;
+ }
+ }
+
+}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityModelType.java
similarity index 79%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java
copy to manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityModelType.java
index 9a1dce1..0682800 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/command/CommandListener.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityModelType.java
@@ -14,10 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.command;
-import org.apache.doris.manager.common.domain.CommandType;
+package org.apache.doris.stack.model.activity;
-public interface CommandListener {
- void beforeExecute(CommandType commandType);
+/**
+ * @Description:Model type of activity
+ */
+public enum ActivityModelType {
+ user,
+ card,
+ dashboard,
+ pulse,
+ metric,
+ segment,
+ install
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityViewInfoResp.java b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityViewInfoResp.java
new file mode 100644
index 0000000..8c4d0b6
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ActivityViewInfoResp.java
@@ -0,0 +1,91 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.model.activity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.sql.Timestamp;
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ActivityViewInfoResp {
+
+ private Integer userId;
+
+ private Integer modelId;
+
+ private String model;
+
+ private int cnt;
+
+ private Timestamp maxTs;
+
+ private ModelObject modelObject;
+
+ @JSONField(name = "user_id")
+ @JsonProperty("user_id")
+ public Integer getUserId() {
+ return userId;
+ }
+
+ @JSONField(name = "user_id")
+ @JsonProperty("user_id")
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ @JSONField(name = "model_id")
+ @JsonProperty("model_id")
+ public Integer getModelId() {
+ return modelId;
+ }
+
+ @JSONField(name = "model_id")
+ @JsonProperty("model_id")
+ public void setModelId(Integer modelId) {
+ this.modelId = modelId;
+ }
+
+ @JSONField(name = "max_ts")
+ @JsonProperty("max_ts")
+ public Timestamp getMaxTs() {
+ return maxTs;
+ }
+
+ @JSONField(name = "max_ts")
+ @JsonProperty("max_ts")
+ public void setMaxTs(Timestamp maxTs) {
+ this.maxTs = maxTs;
+ }
+
+ @JSONField(name = "model_object")
+ @JsonProperty("model_object")
+ public ModelObject getModelObject() {
+ return modelObject;
+ }
+
+ @JSONField(name = "model_object")
+ @JsonProperty("model_object")
+ public void setModelObject(ModelObject modelObject) {
+ this.modelObject = modelObject;
+ }
+
+}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ModelObject.java
similarity index 52%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java
copy to manager/general/src/main/java/org/apache/doris/stack/model/activity/ModelObject.java
index 15cbd85..155c5c2 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/DorisExec.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/activity/ModelObject.java
@@ -14,37 +14,37 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class DorisExec {
+package org.apache.doris.stack.model.activity;
- private String host;
- //FE、BE
- private String role;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
- private boolean master;
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ModelObject {
- public String getHost() {
- return host;
- }
+ private int id;
- public void setHost(String host) {
- this.host = host;
- }
+ private String name;
- public String getRole() {
- return role;
- }
+ private int collectionId;
- public void setRole(String role) {
- this.role = role;
- }
+ private String description;
+
+ private String display;
- public boolean isMaster() {
- return master;
+ @JSONField(name = "collection_id")
+ @JsonProperty("collection_id")
+ public int getCollectionId() {
+ return collectionId;
}
- public void setMaster(boolean master) {
- this.master = master;
+ @JSONField(name = "collection_id")
+ @JsonProperty("collection_id")
+ public void setCollectionId(int collectionId) {
+ this.collectionId = collectionId;
}
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java b/manager/general/src/main/java/org/apache/doris/stack/model/activity/Topic.java
similarity index 62%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
copy to manager/general/src/main/java/org/apache/doris/stack/model/activity/Topic.java
index b5942f2..5d7d403 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/activity/Topic.java
@@ -14,27 +14,22 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class AgentCommon {
+package org.apache.doris.stack.model.activity;
- private String host;
+/**
+ * @Description:All user activity topic definitions
+ */
+public class Topic {
- private Integer port;
+ // First startup record after installation
+ public static final String INSTALL = "install";
- public String getHost() {
- return host;
- }
+ // Activity record of user related operations
+ // Record of user's first login
+ public static final String USE_JOINED = "user-joined";
- public void setHost(String host) {
- this.host = host;
- }
+ // Record of the user's latest login for the first time
+ public static final String USE_LOGIN = "user-login";
- public Integer getPort() {
- return port;
- }
-
- public void setPort(Integer port) {
- this.port = port;
- }
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapConnectionInfo.java
similarity index 68%
copy from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
copy to manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapConnectionInfo.java
index b5942f2..dc5a816 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/AgentCommon.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapConnectionInfo.java
@@ -14,27 +14,33 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class AgentCommon {
+package org.apache.doris.stack.model.ldap;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LdapConnectionInfo {
private String host;
private Integer port;
- public String getHost() {
- return host;
- }
+ private String bindDn;
+
+ private String password;
+
+ private String security;
+
+ private List<String> userBase;
+
+ private String userFilter;
- public void setHost(String host) {
- this.host = host;
- }
+ private String attributeEmail;
- public Integer getPort() {
- return port;
- }
+ private String attributeFirstname;
- public void setPort(Integer port) {
- this.port = port;
- }
+ private String attributeLastname;
}
diff --git a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfo.java
similarity index 71%
copy from manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
copy to manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfo.java
index 6488f61..8ab0559 100644
--- a/manager/dm-agent/src/main/java/org/apache/doris/manager/agent/task/TaskHandler.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfo.java
@@ -14,16 +14,27 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.agent.task;
-import java.util.Date;
+package org.apache.doris.stack.model.ldap;
-public abstract class TaskHandler {
- public void handle(Task task) {
- task.getTaskResult().setSubmitTime(new Date());
- doHandle(task);
- }
+import lombok.Data;
- public abstract void doHandle(Task task);
+@Data
+public class LdapUserInfo {
+ private Boolean auth;
+
+ private Boolean exist;
+
+ private String dn;
+
+ private String firstName;
+
+ private String lastName;
+
+ private String email;
+
+ private String groups;
+
+ private String password;
}
diff --git a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfoReq.java
similarity index 76%
rename from manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
rename to manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfoReq.java
index 91b63e6..7ccd429 100644
--- a/manager/dm-server/src/main/java/org/apache/doris/manager/server/model/req/TaskLogReq.java
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/ldap/LdapUserInfoReq.java
@@ -14,16 +14,21 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.manager.server.model.req;
-public class TaskLogReq extends TaskInfoReq{
- private int offset;
+package org.apache.doris.stack.model.ldap;
- public int getOffset() {
- return offset;
- }
+import lombok.Data;
- public void setOffset(int offset) {
- this.offset = offset;
- }
+import java.util.List;
+
+@Data
+public class LdapUserInfoReq {
+
+ private List<String> baseDn;
+
+ private String userAttribute;
+
+ private String userValue;
+
+ private String password;
}
diff --git a/manager/general/src/main/java/org/apache/doris/stack/model/meta/DataBaseResp.java b/manager/general/src/main/java/org/apache/doris/stack/model/meta/DataBaseResp.java
new file mode 100644
index 0000000..061396f
--- /dev/null
+++ b/manager/general/src/main/java/org/apache/doris/stack/model/meta/DataBaseResp.java
@@ -0,0 +1,445 @@
+// 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
+//
+// http://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.
+
+package org.apache.doris.stack.model.meta;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class DataBaseResp {
+
+ private int id;
+
+ private String description;
+
+ private String timezone;
+
+ private String engine;
+
+ private String caveats;
+
+ private String name;
+
+ private String options;
+
+ private List<String> features;
+
+ private Detail details;
+
+ private List<Table> tables;
+
+ private String updatedAt;
+
+ private String pointsOfInterest;
+
+ private String nativePermissions;
+
+ private String metadataSyncSchedule;
+
+ private boolean autoRunQueries;
+
+ private String cacheFieldValuesSchedule;
+
+ private boolean isFullSync;
+
+ private boolean isOnDemand;
+
+ private boolean isSample;
+
+ @JSONField(name = "updated_at")
+ @JsonProperty("updated_at")
+ public String getUpdatedAt() {
+ return updatedAt;
+ }
+
+ @JSONField(name = "updated_at")
+ @JsonProperty("updated_at")
+ public void setUpdatedAt(String updatedAt) {
+ this.updatedAt = updatedAt;
+ }
+
+ @JSONField(name = "points_of_interest")
+ @JsonProperty("points_of_interest")
+ public String getPointsOfInterest() {
+ return pointsOfInterest;
+ }
+
+ @JSONField(name = "points_of_interest")
+ @JsonProperty("points_of_interest")
+ public void setPointsOfInterest(String pointsOfInterest) {
+ this.pointsOfInterest = pointsOfInterest;
+ }
+
+ @JSONField(name = "native_permissions")
+ @JsonProperty("native_permissions")
+ public String getNativePermissions() {
+ return nativePermissions;
+ }
+
+ @JSONField(name = "native_permissions")
+ @JsonProperty("native_permissions")
+ public void setNativePermissions(String nativePermissions) {
+ this.nativePermissions = nativePermissions;
+ }
+
+ @JSONField(name = "metadata_sync_schedule")
+ @JsonProperty("metadata_sync_schedule")
+ public String getMetadataSyncSchedule() {
+ return metadataSyncSchedule;
+ }
+
+ @JSONField(name = "metadata_sync_schedule")
+ @JsonProperty("metadata_sync_schedule")
+ public void setMetadataSyncSchedule(String metadataSyncSchedule) {
+ this.metadataSyncSchedule = metadataSyncSchedule;
+ }
+
+ @JSONField(name = "auto_run_queries")
+ @JsonProperty("auto_run_queries")
+ public boolean isAutoRunQueries() {
+ return autoRunQueries;
+ }
+
+ @JSONField(name = "auto_run_queries")
+ @JsonProperty("auto_run_queries")
+ public void setAutoRunQueries(boolean autoRunQueries) {
+ this.autoRunQueries = autoRunQueries;
+ }
+
+ @JSONField(name = "cache_field_values_schedule")
+ @JsonProperty("cache_field_values_schedule")
+ public String getCacheFieldValuesSchedule() {
+ return cacheFieldValuesSchedule;
+ }
+
+ @JSONField(name = "cache_field_values_schedule")
+ @JsonProperty("cache_field_values_schedule")
+ public void setCacheFieldValuesSchedule(String cacheFieldValuesSchedule) {
+ this.cacheFieldValuesSchedule = cacheFieldValuesSchedule;
+ }
+
+ @JSONField(name = "is_full_sync")
+ @JsonProperty("is_full_sync")
+ public boolean isFullSync() {
+ return isFullSync;
+ }
+
+ @JSONField(name = "is_full_sync")
+ @JsonProperty("is_full_sync")
+ public void setFullSync(boolean fullSync) {
+ isFullSync = fullSync;
+ }
+
+ @JSONField(name = "is_on_demand")
+ @JsonProperty("is_on_demand")
+ public boolean isOnDemand() {
+ return isOnDemand;
+ }
+
+ @JSONField(name = "is_on_demand")
+ @JsonProperty("is_on_demand")
+ public void setOnDemand(boolean onDemand) {
+ isOnDemand = onDemand;
+ }
+
+ @JSONField(name = "is_sample")
+ @JsonProperty("is_sample")
+ public boolean isSample() {
+ return isSample;
+ }
+
+ @JSONField(name = "is_sample")
+ @JsonProperty("is_sample")
+ public void setSample(boolean sample) {
+ isSample = sample;
+ }
+
+ // todo 后续根据Doris 引擎添加支持特性
+ {
+ this.features = new ArrayList<>();
+ this.features.add("basic-aggregations");
+ this.features.add("standard-deviation-aggregations");
+ this.features.add("expression-aggregations");
+ this.features.add("foreign-keys");
+ this.features.add("right-join");
+ this.features.add("left-join");
+ this.features.add("native-parameters");
+ this.features.add("nested-queries");
+ this.features.add("expressions");
+ this.features.add("set-timezone");
+ this.features.add("binning");
+ this.features.add("inner-join");
+ this.features.add("advanced-math-expressions");
+ }
+
+ /**
+ * Detail
+ */
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public class Detail {
+
+ private static final String DB_NAME = "dbname";
+
+ private static final String HOST = "host";
+
+ private static final String PASSWORD = "password";
+
+ private static final String PORT = "port";
+
+ private static final String USER = "user";
+
+ private String dbName;
+
+ private String host;
+
+ private String password;
+
+ private int port;
+
+ private String user;
+
+ public Detail(String detail) {
+ if (!StringUtils.isEmpty(detail)) {
+ JSONObject jsonObject = JSONObject.parseObject(detail);
+ this.dbName = jsonObject.getString(DB_NAME);
+ this.host = jsonObject.getString(HOST);
+ this.password = jsonObject.getString(PASSWORD);
+ this.port = jsonObject.getInteger(PORT);
+ this.user = jsonObject.getString(USER);
+ }
+ }
+ }
+
+ /**
+ * Table
+ */
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public class Table {
+
+ private boolean active;
+
+ private String caveats;
+
+ private String description;
+
+ private int id;
+
+ private String name;
+
+ private String schema;
+
+ private String createdAt;
+
+ private int dbId;
+
+ private String displayName;
+
+ private String entityName;
+
+ private String entityType;
+
+ private String fieldOrder;
+
+ private String pointsOfInterest;
+
+ private boolean showInGettingStarted;
+
+ private String updatedAt;
+
+ private String visibilityType;
+
+ @JSONField(name = "created_at")
+ @JsonProperty("created_at")
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ @JSONField(name = "created_at")
+ @JsonProperty("created_at")
+ public void setCreatedAt(String createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ @JSONField(name = "db_id")
+ @JsonProperty("db_id")
+ public int getDbId() {
+ return dbId;
+ }
+
+ @JSONField(name = "db_id")
+ @JsonProperty("db_id")
+ public void setDbId(int dbId) {
+ this.dbId = dbId;
+ }
+
+ @JSONField(name = "display_name")
+ @JsonProperty("display_name")
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ @JSONField(name = "display_name")
+ @JsonProperty("display_name")
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ @JSONField(name = "entity_name")
+ @JsonProperty("entity_name")
+ public String getEntityName() {
+ return entityName;
+ }
+
+ @JSONField(name = "entity_name")
+ @JsonProperty("entity_name")
+ public void setEntityName(String entityName) {
+ this.entityName = entityName;
+ }
+
+ @JSONField(name = "entity_type")
+ @JsonProperty("entity_type")
+ public String getEntityType() {
+ return entityType;
+ }
+
+ @JSONField(name = "entity_type")
+ @JsonProperty("entity_type")
+ public void setEntityType(String entityType) {
+ this.entityType = entityType;
+ }
+
+ @JSONField(name = "field_order")
+ @JsonProperty("field_order")
+ public String getFieldOrder() {
+ return fieldOrder;
+ }
+
+ @JSONField(name = "field_order")
+ @JsonProperty("field_order")
... 23334 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org