From 2bf3b22d645f7bed248b313fddad5fefed0f91c1 Mon Sep 17 00:00:00 2001 From: Kirs Date: Tue, 30 Nov 2021 14:03:21 +0800 Subject: [PATCH] [2.0.1-cherrypick] SPI(Task ,Alert ,DataSource) (#7041) * data source spi * Fix datasource not work in tests and standalone server, and run all tests by default (#6743) * Refactor alert plugins and simplify its usage (#6723) * [Fix-6792] resolve API and alert port conflicts (#6792) (#6815) * [Fix-6792]Multiple ApplicationRunners on classpath make SpringApplication.run only run one (#6792) * [Feature][datasource] Change DataSource Connection Pool from Druid to HiKariCP (#6490) (#6828) * [Feature][datasource] Change DataSource Connection Pool from Druid to HiKariCP (#6490) * fix pom dep scope * filter alert * filter alert * filter alert * fix checkstyle * remove hikaricp version * update pom * add properties * add properties * rename properties * fix e2e fail * rename properties * [Fix-6792] resolve API and alert port conflicts (#6792) (#6815) [Fix-6792]Multiple ApplicationRunners on classpath make SpringApplication.run only run one (#6792) * fix ut fail * fix license * fix license * update package * update package * remove unused license Co-authored-by: mask <39329477+narcasserun@users.noreply.github.com> Co-authored-by: kezhenxu94 --- .github/CODEOWNERS | 1 + .github/workflows/unit-test.yml | 7 - .licenserc.yaml | 2 +- .../dolphinscheduler/alert.properties.tpl | 30 - .../dolphinscheduler/quartz.properties.tpl | 2 +- docker/build/startup-init-conf.sh | 1 - docker/docker-swarm/config.env.sh | 1 - .../kubernetes/dolphinscheduler/values.yaml | 1 - .../dolphinscheduler-alert-dingtalk/pom.xml | 82 -- .../dolphinscheduler-alert-email/pom.xml | 115 --- .../alert/email/EmailAlertChannelFactory.java | 140 ---- .../alert/email/EmailAlertChannelTest.java | 163 ---- .../alert/http/HttpAlertChannelFactory.java | 78 -- .../alert/slack/SlackAlertPluginTest.java | 36 - .../dolphinscheduler-alert-wechat/pom.xml | 77 -- .../wechat/WeChatAlertChannelFactory.java | 94 --- .../alert/wechat/WeChatAlertPlugin.java | 34 - .../dolphinscheduler-alert-api/pom.xml | 38 + .../alert/api/AlertChannel.java | 24 + .../alert/api/AlertChannelFactory.java | 35 + .../alert/api/AlertConstants.java | 33 + .../dolphinscheduler/alert/api/AlertData.java | 168 ++++ .../dolphinscheduler/alert/api/AlertInfo.java | 125 +++ .../alert/api/AlertResult.java | 123 +++ .../dolphinscheduler/alert/api/ShowType.java | 49 ++ .../dolphinscheduler-alert-dingtalk/pom.xml | 41 + .../alert/dingtalk/DingTalkAlertChannel.java | 14 +- .../dingtalk/DingTalkAlertChannelFactory.java | 74 +- .../dingtalk/DingTalkParamsConstants.java | 30 +- .../plugin/alert/dingtalk/DingTalkSender.java | 82 +- .../DingTalkAlertChannelFactoryTest.java | 10 +- .../alert/dingtalk/DingTalkSenderTest.java | 9 +- .../dolphinscheduler-alert-email/pom.xml | 50 ++ .../plugin/alert/email/EmailAlertChannel.java | 25 +- .../alert/email/EmailAlertChannelFactory.java | 139 ++++ .../plugin/alert/email/EmailConstants.java | 49 +- .../plugin/alert/email/ExcelUtils.java | 18 +- .../alert/email/MailParamsConstants.java | 36 +- .../plugin/alert/email/MailSender.java | 133 ++- .../email/exception/AlertEmailException.java | 12 - .../alert/email/template/AlertTemplate.java | 11 +- .../email/template/DefaultHTMLTemplate.java | 7 +- .../email/EmailAlertChannelFactoryTest.java | 17 +- .../alert/email/EmailAlertChannelTest.java | 156 ++++ .../plugin/alert/email/ExcelUtilsTest.java | 0 .../plugin/alert/email/MailUtilsTest.java | 50 +- .../template/DefaultHTMLTemplateTest.java | 33 +- .../dolphinscheduler-alert-feishu/pom.xml | 40 + .../alert/feishu/FeiShuAlertChannel.java | 11 +- .../feishu/FeiShuAlertChannelFactory.java | 67 +- .../alert/feishu/FeiShuParamsConstants.java | 36 +- .../plugin/alert/feishu/FeiShuSender.java | 91 ++- .../plugin/alert/feishu/HttpRequestUtil.java | 5 +- .../feishu/FeiShuAlertChannelFactoryTest.java | 4 +- .../plugin/alert/feishu/FeiShuSenderTest.java | 40 +- .../dolphinscheduler-alert-http/pom.xml | 47 ++ .../plugin/alert/http/HttpAlertChannel.java | 14 +- .../alert/http/HttpAlertChannelFactory.java | 78 ++ .../plugin/alert/http/HttpAlertConstants.java | 44 + .../plugin/alert/http/HttpSender.java | 60 +- .../http/HttpAlertChannelFactoryTest.java | 7 +- .../alert/http/HttpAlertChannelTest.java | 41 +- .../plugin/alert/http/HttpSenderTest.java | 21 +- .../dolphinscheduler-alert-script/pom.xml | 36 + .../plugin/alert/script/OSUtils.java | 8 +- .../plugin/alert/script/ProcessUtils.java | 13 +- .../alert/script/ScriptAlertChannel.java | 16 +- .../script/ScriptAlertChannelFactory.java | 48 +- .../alert/script/ScriptParamsConstants.java | 20 +- .../plugin/alert/script/ScriptSender.java | 25 +- .../plugin/alert/script/ScriptType.java | 13 +- .../plugin/alert/script/StreamGobbler.java | 17 +- .../plugin/alert/script/ProcessUtilsTest.java | 2 +- .../script/ScriptAlertChannelFactoryTest.java | 4 +- .../plugin/alert/script/ScriptSenderTest.java | 6 +- .../src/test/script/shell/scriptExample.sh | 0 .../src/test/script/shell/test.sh | 0 .../dolphinscheduler-alert-slack/pom.xml | 41 + .../plugin/alert/slack/SlackAlertChannel.java | 14 +- .../alert/slack/SlackAlertChannelFactory.java | 37 +- .../alert/slack/SlackParamsConstants.java | 15 +- .../plugin/alert/slack/SlackSender.java | 25 +- .../slack/SlackAlertChannelFactoryTest.java | 8 +- .../plugin/alert/slack/SlackSenderTest.java | 4 +- .../dolphinscheduler-alert-wechat}/pom.xml | 49 +- .../alert/wechat/WeChatAlertChannel.java | 14 +- .../wechat/WeChatAlertChannelFactory.java | 93 +++ .../alert/wechat/WeChatAlertConstants.java | 14 +- .../wechat/WeChatAlertParamsConstants.java | 42 +- .../plugin/alert/wechat/WeChatSender.java | 286 +++---- .../wechat/WeChatAlertChannelFactoryTest.java | 4 +- .../plugin/alert/wechat/WeChatSenderTest.java | 57 +- .../dolphinscheduler-alert-plugins}/pom.xml | 14 +- .../dolphinscheduler-alert-server/pom.xml | 130 +++ .../alert/AlertPluginManager.java | 89 ++ .../alert}/AlertRequestProcessor.java | 39 +- .../dolphinscheduler/alert}/AlertSender.java | 83 +- .../dolphinscheduler/alert/AlertServer.java | 125 +++ .../src/main/resources/logback-alert.xml | 4 +- .../alert/plugin/EmailAlertPluginTest.java | 174 ++-- .../processor/AlertRequestProcessorTest.java | 20 +- .../alert/runner/AlertSenderTest.java | 85 +- dolphinscheduler-alert/pom.xml | 129 +-- .../dolphinscheduler/alert/AlertServer.java | 156 ---- .../alert/plugin/AlertPluginManager.java | 115 --- .../alert/utils/Constants.java | 38 - .../alert/AlertServerTest.java | 91 --- .../alert/plugin/AlertPluginManagerTest.java | 67 -- .../alert/plugin/DolphinPluginLoaderTest.java | 55 -- .../alert/utils/PropertyUtilsTest.java | 221 ----- dolphinscheduler-api/pom.xml | 45 +- .../api/ApiApplicationServer.java | 16 +- .../api/controller/DataSourceController.java | 8 +- .../api/service/DataSourceService.java | 6 +- .../service/impl/DataSourceServiceImpl.java | 13 +- .../dolphinscheduler/api/HttpClientTest.java | 157 ---- .../controller/AbstractControllerTest.java | 34 +- .../controller/DataSourceControllerTest.java | 2 +- .../controller/EnvironmentControllerTest.java | 7 +- .../security/SecurityConfigLDAPTest.java~dev | 45 -- .../impl/ldap/LdapAuthenticatorTest.java | 1 + .../security/impl/ldap/LdapServiceTest.java | 7 +- .../impl/pwd/PasswordAuthenticatorTest.java | 1 + .../api/service/DataAnalysisServiceTest.java | 38 +- .../api/service/DataSourceServiceTest.java | 48 +- .../api/service/MonitorServiceTest.java | 2 +- dolphinscheduler-common/pom.xml | 38 - .../dolphinscheduler/common/Constants.java | 68 +- .../BaseHdfsDatasourceParamDTO.java | 61 -- .../datasource/DatasourceProcessor.java | 81 -- .../ClickHouseDatasourceParamDTO.java | 41 - .../datasource/db2/Db2DatasourceParamDTO.java | 43 - .../datasource/hive/HiveConnectionParam.java | 38 - .../hive/HiveDataSourceParamDTO.java | 45 -- .../mysql/MysqlConnectionParam.java | 34 - .../mysql/MysqlDatasourceParamDTO.java | 43 - .../oracle/OracleConnectionParam.java | 46 -- .../oracle/OracleDatasourceParamDTO.java | 55 -- .../PostgreSqlDatasourceParamDTO.java | 41 - .../presto/PrestoDatasourceParamDTO.java | 43 - .../spark/SparkDatasourceParamDTO.java | 45 -- .../SqlServerDatasourceParamDTO.java | 43 - .../dolphinscheduler/common/enums/DbType.java | 60 -- .../common/enums/ProfileType.java | 21 +- .../common/utils/CommonUtils.java | 2 +- .../common/utils/PropertyUtils.java | 57 +- .../src/main/resources/common.properties | 3 + .../dolphinscheduler/common/CommonTest.java | 46 -- .../threadutils/ThreadPoolExecutorsTest.java | 9 +- .../common/utils/CommonUtilsTest.java | 76 +- .../common/utils/NetUtilsTest.java | 20 +- .../common/utils/OSUtilsTest.java | 112 --- .../placeholder/TimePlaceholderUtilsTest.java | 9 +- dolphinscheduler-dao/pom.xml | 81 +- .../apache/dolphinscheduler/dao/AlertDao.java | 39 +- .../dolphinscheduler/dao/DaoFactory.java | 2 +- .../dolphinscheduler/dao/MonitorDBDao.java | 15 +- .../dolphinscheduler/dao/PluginDao.java | 32 +- .../dao/datasource/ConnectionFactory.java | 149 ---- .../datasource/SpringConnectionFactory.java | 141 +++- .../dao/entity/DataSource.java | 9 +- .../dao/entity/MonitorRecord.java | 5 +- .../dao/mapper/PluginDefineMapper.java | 6 +- .../dao/upgrade/DolphinSchedulerManager.java | 91 +-- .../dao/upgrade/MysqlUpgradeDao.java | 30 +- .../dao/upgrade/PostgresqlUpgradeDao.java | 60 +- .../dao/upgrade/UpgradeDao.java | 254 +----- .../upgrade/shell/CreateDolphinScheduler.java | 60 +- .../upgrade/shell/InitDolphinScheduler.java | 49 +- .../shell/UpgradeDolphinScheduler.java | 56 +- .../dao/utils/MysqlPerformance.java | 9 +- .../dao/utils/PostgrePerformance.java | 8 +- .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../resources/sql}/dolphinscheduler_h2.sql | 0 .../resources/sql}/dolphinscheduler_mysql.sql | 0 .../sql}/dolphinscheduler_postgre.sql | 0 .../src/main/resources/sql}/soft_version | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../mysql/dolphinscheduler_ddl.sql | 0 .../mysql/dolphinscheduler_ddl_post.sql | 0 .../mysql/dolphinscheduler_dml.sql | 0 .../postgresql/dolphinscheduler_ddl.sql | 0 .../postgresql/dolphinscheduler_ddl_post.sql | 0 .../postgresql/dolphinscheduler_dml.sql | 0 .../dolphinscheduler/dao/AlertDaoTest.java | 30 +- .../dolphinscheduler/dao/BaseDaoTest.java | 31 +- .../dao/mapper/DataSourceMapperTest.java | 2 +- .../dao/mapper/PluginDefineTest.java | 26 +- .../dao/upgrade/ProcessDefinitionDaoTest.java | 13 +- .../dao/upgrade/WorkerGroupDaoTest.java | 21 +- .../dolphinscheduler-datasource-all/pom.xml | 60 ++ .../dolphinscheduler-datasource-api/pom.xml | 153 ++++ .../api/client/CommonDataSourceClient.java | 128 +++ .../AbstractDatasourceProcessor.java | 12 +- .../datasource/BaseDataSourceParamDTO.java | 24 +- .../datasource/BaseHdfsConnectionParam.java | 4 +- .../BaseHdfsDatasourceParamDTO.java | 2 +- .../api}/datasource/DatasourceProcessor.java | 14 +- .../ClickHouseDatasourceParamDTO.java | 4 +- .../ClickHouseDatasourceProcessor.java | 30 +- .../clickhouse/ClickhouseConnectionParam.java | 7 +- .../datasource/db2/Db2ConnectionParam.java | 7 +- .../datasource/db2/Db2DatasourceParamDTO.java | 4 +- .../db2/Db2DatasourceProcessor.java | 34 +- .../datasource/hive/HiveConnectionParam.java | 7 +- .../hive/HiveDataSourceParamDTO.java | 4 +- .../hive/HiveDatasourceProcessor.java | 42 +- .../mysql/MysqlConnectionParam.java | 8 +- .../mysql/MysqlDatasourceParamDTO.java | 4 +- .../mysql/MysqlDatasourceProcessor.java | 36 +- .../oracle/OracleConnectionParam.java | 8 +- .../oracle/OracleDatasourceParamDTO.java | 4 +- .../oracle/OracleDatasourceProcessor.java | 34 +- .../postgresql/PostgreSqlConnectionParam.java | 7 +- .../PostgreSqlDatasourceParamDTO.java | 4 +- .../PostgreSqlDatasourceProcessor.java | 30 +- .../presto/PrestoConnectionParam.java | 7 +- .../presto/PrestoDatasourceParamDTO.java | 4 +- .../presto/PrestoDatasourceProcessor.java | 30 +- .../spark/SparkConnectionParam.java | 7 +- .../spark/SparkDatasourceParamDTO.java | 4 +- .../spark/SparkDatasourceProcessor.java | 36 +- .../sqlserver/SqlServerConnectionParam.java | 7 +- .../SqlServerDatasourceParamDTO.java | 4 +- .../SqlServerDatasourceProcessor.java | 30 +- .../api/plugin/DataSourceClientProvider.java | 73 ++ .../api/plugin/DataSourcePluginManager.java | 66 ++ .../api/provider/JdbcDataSourceProvider.java | 83 ++ .../datasource/api/utils}/CommonUtils.java | 5 +- .../datasource/api/utils}/DatasourceUtil.java | 43 +- .../datasource/api/utils}/PasswordUtils.java | 2 +- .../client/CommonDataSourceClientTest.java | 100 +++ .../ClickHouseDatasourceProcessorTest.java | 26 +- .../db2/Db2DatasourceProcessorTest.java | 25 +- .../hive/HiveDatasourceProcessorTest.java | 31 +- .../mysql/MysqlDatasourceProcessorTest.java | 40 +- .../oracle/OracleDatasourceProcessorTest.java | 29 +- .../PostgreSqlDatasourceProcessorTest.java | 27 +- .../presto/PrestoDatasourceProcessorTest.java | 27 +- .../spark/SparkDatasourceProcessorTest.java | 29 +- .../SqlServerDatasourceProcessorTest.java | 29 +- .../provider/JdbcDataSourceProviderTest.java | 52 ++ .../datasource/api/utils/CommonUtilsTest.java | 124 +++ .../api/utils}/DatasourceUtilTest.java | 42 +- .../pom.xml | 89 ++ .../ClickhouseDataSourceChannel.java | 14 +- .../ClickhouseDataSourceChannelFactory.java | 36 + .../ClickhouseDataSourceClient.java | 20 +- ...lickhouseDataSourceChannelFactoryTest.java | 19 +- .../ClickhouseDataSourceChannelTest.java | 43 + .../dolphinscheduler-datasource-db2/pom.xml | 65 ++ .../datasource/db2/DB2DataSourceChannel.java | 18 +- .../db2/DB2DataSourceChannelFactory.java | 20 +- .../datasource/db2/DB2DataSourceClient.java | 14 +- .../db2/DB2DataSourceChannelFactoryTest.java | 24 +- .../db2/DB2DataSourceChannelTest.java | 43 + .../dolphinscheduler-datasource-hive/pom.xml | 345 ++++++++ .../hive/HiveDataSourceChannel.java | 18 +- .../hive/HiveDataSourceChannelFactory.java | 36 + .../datasource/hive/HiveDataSourceClient.java | 112 +++ .../plugin/datasource/utils/CommonUtil.java | 65 ++ .../HiveDataSourceChannelFactoryTest.java | 33 + .../hive/HiveDataSourceChannelTest.java | 43 + .../pom.xml | 48 +- .../mysql/MysqlDataSourceChannel.java | 19 +- .../mysql/MysqlDataSourceChannelFactory.java | 36 + .../mysql/MysqlDataSourceClient.java | 17 +- .../MysqlDataSourceChannelFactoryTest.java | 33 + .../mysql/MysqlDataSourceChannelTest.java | 43 + .../pom.xml | 65 ++ .../oracle/OracleDataSourceChannel.java | 18 +- .../OracleDataSourceChannelFactory.java | 36 + .../oracle/OracleDataSourceClient.java | 29 + .../OracleDataSourceChannelFactoryTest.java | 33 + .../oracle/OracleDataSourceChannelTest.java | 43 + .../pom.xml | 50 +- .../PostgresqlDataSourceChannel.java | 30 + .../PostgresqlDataSourceChannelFactory.java | 36 + .../PostgresqlDataSourceClient.java | 29 + ...ostgresqlDataSourceChannelFactoryTest.java | 33 + .../PostgresqlDataSourceChannelTest.java | 43 + .../pom.xml | 63 +- .../sqlserver/SqlServerDataSourceChannel.java | 17 +- .../SqlServerDataSourceChannelFactory.java | 36 + .../sqlserver/SqlserverDataSourceClient.java | 29 + ...SqlserverDataSourceChannelFactoryTest.java | 33 + .../SqlserverDataSourceChannelTest.java | 43 + dolphinscheduler-datasource-plugin/pom.xml | 42 + dolphinscheduler-dist/pom.xml | 10 +- dolphinscheduler-dist/release-docs/LICENSE | 147 ++-- dolphinscheduler-dist/release-docs/NOTICE | 47 -- .../licenses/LICENSE-LatencyUtils.txt | 38 + .../licenses/LICENSE-aether-api.txt | 86 -- ...CENSE-aether-connector-asynchttpclient.txt | 86 -- .../LICENSE-aether-connector-file.txt | 86 -- .../licenses/LICENSE-aether-impl.txt | 86 -- .../licenses/LICENSE-aether-spi.txt | 86 -- .../licenses/LICENSE-aether-util.txt | 86 -- .../licenses/LICENSE-apache-el.txt | 202 ----- .../licenses/LICENSE-async-http-client.txt | 13 - .../licenses/LICENSE-hamcrest-core.txt | 27 - .../licenses/LICENSE-hibernate-validator.txt | 203 ----- .../licenses/LICENSE-javax.activation-api.txt | 758 ------------------ .../licenses/LICENSE-javax.servlet-api.txt | 263 ------ .../licenses/LICENSE-jboss-logging.txt | 202 ----- .../release-docs/licenses/LICENSE-junit.txt | 213 ----- .../LICENSE-maven-aether-provider.txt | 202 ----- .../licenses/LICENSE-maven-artifact.txt | 202 ----- .../licenses/LICENSE-maven-compat.txt | 202 ----- .../licenses/LICENSE-maven-core.txt | 202 ----- .../licenses/LICENSE-maven-embedder.txt | 202 ----- .../licenses/LICENSE-maven-model-builder.txt | 202 ----- .../licenses/LICENSE-maven-model.txt | 202 ----- .../licenses/LICENSE-maven-plugin-api.txt | 202 ----- .../LICENSE-maven-repository-metadata.txt | 202 ----- .../LICENSE-maven-settings-builder.txt | 202 ----- .../licenses/LICENSE-maven-settings.txt | 202 ----- .../licenses/LICENSE-plexus-cipher.txt | 202 ----- .../licenses/LICENSE-plexus-classworlds.txt | 202 ----- .../LICENSE-plexus-component-annotations.txt | 202 ----- .../LICENSE-plexus-container-default.txt | 202 ----- .../licenses/LICENSE-plexus-interpolation.txt | 202 ----- .../LICENSE-plexus-sec-dispatcher.txt | 202 ----- .../licenses/LICENSE-plexus-utils.txt | 202 ----- .../licenses/LICENSE-resolver.txt | 202 ----- .../licenses/LICENSE-validation-api.txt | 4 - .../licenses/LICENSE-wagon-provider-api.txt | 202 ----- .../licenses/LICENSE-xmlbeans.txt | 201 ----- .../main/assembly/dolphinscheduler-bin.xml | 54 +- .../src/main/provisio/dolphinscheduler.xml | 98 --- .../dolphinscheduler/registry/api/Event.java | 107 ++- .../pom.xml | 13 - .../ZookeeperConnectionStateListener.java | 11 +- dolphinscheduler-registry/pom.xml | 14 - dolphinscheduler-remote/pom.xml | 17 - dolphinscheduler-server/pom.xml | 115 ++- .../server/log/LoggerServer.java | 6 +- .../server/master/MasterServer.java | 11 +- .../server/worker/WorkerServer.java | 66 +- .../worker/plugin/TaskPluginManager.java | 93 +-- .../worker/runner/TaskExecuteThread.java | 39 +- .../main/resources/config/install_config.conf | 6 - .../master/WorkflowExecuteThreadTest.java | 69 +- .../TaskPriorityQueueConsumerTest.java | 2 +- .../runner/task/CommonTaskProcessorTest.java | 2 +- dolphinscheduler-service/pom.xml | 65 +- ...der.java => HikariConnectionProvider.java} | 19 +- .../service/quartz/QuartzExecutors.java | 2 +- .../src/main/resources/quartz.properties | 2 +- dolphinscheduler-spi/pom.xml | 59 +- .../spi/DolphinSchedulerPlugin.java | 52 -- .../spi/alert/AlertChannelFactory.java | 33 - .../dolphinscheduler/spi/alert/AlertData.java | 77 -- .../dolphinscheduler/spi/alert/AlertInfo.java | 52 -- .../spi/alert/AlertResult.java | 49 -- .../dolphinscheduler/spi/alert/ShowType.java | 51 -- .../classloader/ThreadContextClassLoader.java | 35 - .../spi}/datasource/BaseConnectionParam.java | 58 +- .../spi}/datasource/ConnectionParam.java | 2 +- .../DataSourceChannel.java} | 11 +- .../datasource/DataSourceChannelFactory.java | 16 +- .../DataSourceClient.java} | 13 +- .../dolphinscheduler/spi/enums/DbType.java | 36 +- .../plugin/AbstractDolphinPluginManager.java | 25 - .../spi/plugin/DolphinPluginClassLoader.java | 140 ---- .../spi/plugin/DolphinPluginDiscovery.java | 150 ---- .../spi/plugin/DolphinPluginLoader.java | 211 ----- .../plugin/DolphinPluginManagerConfig.java | 119 --- .../spi/task/AbstractParameters.java | 19 +- .../spi/task/TaskConstants.java | 2 +- .../spi/utils/CollectionUtils.java | 152 ---- .../dolphinscheduler/spi/utils/Constants.java | 121 +++ .../dolphinscheduler/spi/utils/DateUtils.java | 307 ------- .../dolphinscheduler/spi/utils/JSONUtils.java | 72 -- .../spi/utils/PropertyUtils.java | 120 +-- .../spi/utils/StringUtils.java | 52 -- dolphinscheduler-standalone-server/pom.xml | 2 +- .../server/StandaloneServer.java | 96 +-- .../main/resources/application-h2.properties | 16 +- .../dolphinscheduler-task-api/pom.xml | 7 +- .../AbstractDatasourceProcessor.java | 79 -- .../task/datasource/BaseConnectionParam.java | 108 --- .../datasource/BaseDataSourceParamDTO.java | 161 ---- .../datasource/BaseHdfsConnectionParam.java | 57 -- .../task/datasource/DatasourceUtil.java | 94 --- .../plugin/task/datasource/HiveConfUtils.java | 87 -- .../ClickHouseDatasourceProcessor.java | 131 --- .../clickhouse/ClickhouseConnectionParam.java | 34 - .../datasource/db2/Db2ConnectionParam.java | 34 - .../db2/Db2DatasourceProcessor.java | 132 --- .../hive/HiveDatasourceProcessor.java | 192 ----- .../mysql/MysqlDatasourceProcessor.java | 176 ---- .../oracle/OracleDatasourceProcessor.java | 149 ---- .../postgresql/PostgreSqlConnectionParam.java | 34 - .../PostgreSqlDatasourceProcessor.java | 132 --- .../presto/PrestoConnectionParam.java | 34 - .../presto/PrestoDatasourceProcessor.java | 134 ---- .../spark/SparkConnectionParam.java | 38 - .../spark/SparkDatasourceProcessor.java | 161 ---- .../sqlserver/SqlServerConnectionParam.java | 34 - .../SqlServerDatasourceProcessor.java | 129 --- .../dolphinscheduler-task-datax/pom.xml | 21 +- .../plugin/task/datax/DataxTask.java | 11 +- .../task/datax/DataxTaskChannelFactory.java | 3 + .../dolphinscheduler-task-flink/pom.xml | 10 +- .../task/flink/FlinkTaskChannelFactory.java | 3 + .../plugin/task/flink/FlinkTaskPlugin.java | 30 - .../dolphinscheduler-task-http/pom.xml | 15 +- .../plugin/task/http/HttpTask.java | 2 +- .../task/http/HttpTaskChannelFactory.java | 3 + .../plugin/task/http/HttpTaskPlugin.java | 31 - .../dolphinscheduler-task-mr/pom.xml | 12 +- .../task/mr/MapReduceTaskChannelFactory.java | 3 + .../plugin/task/mr/MapReduceTaskPlugin.java | 31 - .../dolphinscheduler-task-pigeon/pom.xml | 33 +- .../plugin/task/pigeon/PigeonTask.java | 4 +- .../task/pigeon/PigeonTaskChannelFactory.java | 3 + .../plugin/task/pigeon/PigeonTaskPlugin.java | 31 - .../dolphinscheduler-task-procedure/pom.xml | 21 +- .../plugin/task/procedure/ProcedureTask.java | 12 +- .../ProcedureTaskChannelFactory.java | 3 + .../task/procedure/ProcedureTaskPlugin.java | 31 - .../dolphinscheduler-task-python/pom.xml | 28 +- .../task/python/PythonCommandExecutor.java | 205 ----- .../plugin/task/python/PythonTask.java | 77 +- .../task/python/PythonTaskChannelFactory.java | 3 + .../plugin/task/python/PythonTaskPlugin.java | 31 - .../dolphinscheduler-task-shell/pom.xml | 10 +- .../task/shell/ShellTaskChannelFactory.java | 3 + .../plugin/task/shell/ShellTaskPlugin.java | 31 - .../dolphinscheduler-task-spark/pom.xml | 10 +- .../task/spark/SparkTaskChannelFactory.java | 3 + .../plugin/task/spark/SparkTaskPlugin.java | 31 - .../dolphinscheduler-task-sql/pom.xml | 20 +- .../plugin/task/sql/SqlParameters.java | 3 +- .../plugin/task/sql/SqlTask.java | 22 +- .../task/sql/SqlTaskChannelFactory.java | 3 + .../plugin/task/sql/SqlTaskPlugin.java | 31 - .../dolphinscheduler-task-sqoop/pom.xml | 21 +- .../task/sqoop/SqoopTaskChannelFactory.java | 3 + .../plugin/task/sqoop/SqoopTaskPlugin.java | 31 - .../task/sqoop/generator/CommonGenerator.java | 3 +- .../sources/MysqlSourceGenerator.java | 6 +- .../targets/MysqlTargetGenerator.java | 6 +- dolphinscheduler-task-plugin/pom.xml | 6 +- install.sh | 3 - pom.xml | 591 ++++++-------- script/dolphinscheduler-daemon.sh | 9 +- tools/dependencies/known-dependencies.txt | 138 ++-- 485 files changed, 7677 insertions(+), 17994 deletions(-) delete mode 100644 docker/build/conf/dolphinscheduler/alert.properties.tpl delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPluginTest.java delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java delete mode 100644 dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertPlugin.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/pom.xml create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/ShowType.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java (80%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java (57%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java (69%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java (72%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java (91%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java (90%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java (71%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java (52%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java (92%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java (66%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java (79%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java (83%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java (86%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java (95%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java (82%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java (100%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java (80%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java (71%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java (81%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java (52%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java (52%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java (66%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java (92%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java (92%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java (74%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java (78%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java (84%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java (93%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java (70%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java (73%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java (88%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java (84%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java (77%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java (52%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java (76%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java (86%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java (94%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java (81%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java (93%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java (91%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java (97%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh (100%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-script/src/test/script/shell/test.sh (100%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/pom.xml rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java (82%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java (61%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java (81%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java (88%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java (87%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java (95%) rename {dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack => dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat}/pom.xml (55%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java (80%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java (89%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java (69%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java (78%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java (92%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java (72%) rename {dolphinscheduler-alert-plugin => dolphinscheduler-alert/dolphinscheduler-alert-plugins}/pom.xml (76%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertPluginManager.java rename dolphinscheduler-alert/{src/main/java/org/apache/dolphinscheduler/alert/processor => dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert}/AlertRequestProcessor.java (56%) rename dolphinscheduler-alert/{src/main/java/org/apache/dolphinscheduler/alert/runner => dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert}/AlertSender.java (70%) create mode 100644 dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java rename dolphinscheduler-alert/{ => dolphinscheduler-alert-server}/src/main/resources/logback-alert.xml (95%) rename dolphinscheduler-alert/{ => dolphinscheduler-alert-server}/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java (57%) rename dolphinscheduler-alert/{ => dolphinscheduler-alert-server}/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java (77%) rename dolphinscheduler-alert/{ => dolphinscheduler-alert-server}/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java (60%) delete mode 100644 dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java delete mode 100644 dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManager.java delete mode 100644 dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java delete mode 100644 dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java delete mode 100644 dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java delete mode 100644 dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/DolphinPluginLoaderTest.java delete mode 100644 dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/PropertyUtilsTest.java delete mode 100644 dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/HttpClientTest.java delete mode 100644 dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~dev delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceProcessor.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveConnectionParam.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDataSourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlConnectionParam.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleConnectionParam.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceParamDTO.java delete mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/DbType.java rename dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDaoTest.java => dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ProfileType.java (66%) delete mode 100644 dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/CommonTest.java delete mode 100644 dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java delete mode 100644 dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java rename {sql => dolphinscheduler-dao/src/main/resources/sql}/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/create/release-1.0.0_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/create/release-1.2.0_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/dolphinscheduler_h2.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/dolphinscheduler_mysql.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/dolphinscheduler_postgre.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/soft_version (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.0.1_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.0.1_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.0.2_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.0.2_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.1.0_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.1.0_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.2.0_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.2.0_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.2.0_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.2_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.2_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.2_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.2_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.3_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.3_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.3_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.5_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.5_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.5_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.5_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.6_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.6_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.6_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.6_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.7_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.7_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.7_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/1.3.7_schema/postgresql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl_post.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/mysql/dolphinscheduler_dml.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl_post.sql (100%) rename {sql => dolphinscheduler-dao/src/main/resources/sql}/upgrade/2.0.0_schema/postgresql/dolphinscheduler_dml.sql (100%) rename dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~HEAD => dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/BaseDaoTest.java (59%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/AbstractDatasourceProcessor.java (81%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/BaseDataSourceParamDTO.java (79%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/BaseHdfsConnectionParam.java (92%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/BaseHdfsDatasourceParamDTO.java (96%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/DatasourceProcessor.java (87%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/clickhouse/ClickHouseDatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/clickhouse/ClickHouseDatasourceProcessor.java (80%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/clickhouse/ClickhouseConnectionParam.java (78%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/db2/Db2ConnectionParam.java (78%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/db2/Db2DatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/db2/Db2DatasourceProcessor.java (79%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/hive/HiveConnectionParam.java (81%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/hive/HiveDataSourceParamDTO.java (90%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/hive/HiveDatasourceProcessor.java (83%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/mysql/MysqlConnectionParam.java (78%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/mysql/MysqlDatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/mysql/MysqlDatasourceProcessor.java (83%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/oracle/OracleConnectionParam.java (82%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/oracle/OracleDatasourceParamDTO.java (91%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/oracle/OracleDatasourceProcessor.java (81%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/postgresql/PostgreSqlConnectionParam.java (78%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/postgresql/PostgreSqlDatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/postgresql/PostgreSqlDatasourceProcessor.java (80%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/presto/PrestoConnectionParam.java (78%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/presto/PrestoDatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/presto/PrestoDatasourceProcessor.java (80%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/spark/SparkConnectionParam.java (81%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/spark/SparkDatasourceParamDTO.java (90%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/spark/SparkDatasourceProcessor.java (82%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/sqlserver/SqlServerConnectionParam.java (78%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/sqlserver/SqlServerDatasourceParamDTO.java (89%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/sqlserver/SqlServerDatasourceProcessor.java (80%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourcePluginManager.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils}/CommonUtils.java (96%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils}/DatasourceUtil.java (73%) rename {dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils}/PasswordUtils.java (98%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.java rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java (74%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/db2/Db2DatasourceProcessorTest.java (72%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/hive/HiveDatasourceProcessorTest.java (68%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/mysql/MysqlDatasourceProcessorTest.java (63%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/oracle/OracleDatasourceProcessorTest.java (72%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java (73%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/presto/PrestoDatasourceProcessorTest.java (72%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/spark/SparkDatasourceProcessorTest.java (70%) rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api}/datasource/sqlserver/SqlServerDatasourceProcessorTest.java (72%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtilsTest.java rename {dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils}/DatasourceUtilTest.java (76%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/pom.xml rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannel.java (62%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactory.java rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceClient.java (66%) rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPluginTest.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactoryTest.java (65%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/pom.xml rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannel.java (63%) rename dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactory.java (61%) rename dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/exception/PluginNotFoundException.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceClient.java (67%) rename dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ConnectionFactoryTest.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactoryTest.java (65%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/pom.xml rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannel.java (62%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactory.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/utils/CommonUtil.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactoryTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelTest.java rename {dolphinscheduler-alert-plugin/dolphinscheduler-alert-script => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql}/pom.xml (57%) rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannel.java (62%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactory.java rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/exception/WeChatAlertException.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceClient.java (66%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactoryTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/pom.xml rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannel.java (62%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactory.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceClient.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactoryTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelTest.java rename {dolphinscheduler-alert-plugin/dolphinscheduler-alert-http => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql}/pom.xml (61%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannel.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactory.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceClient.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactoryTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelTest.java rename {dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver}/pom.xml (53%) rename dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertPlugin.java => dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannel.java (62%) create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannelFactory.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceClient.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelFactoryTest.java create mode 100644 dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelTest.java create mode 100644 dolphinscheduler-datasource-plugin/pom.xml create mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-LatencyUtils.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-asynchttpclient.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-file.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-impl.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-spi.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-util.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-apache-el.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-async-http-client.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-hamcrest-core.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-hibernate-validator.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.activation-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.servlet-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-jboss-logging.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-junit.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-aether-provider.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-artifact.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-compat.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-core.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-embedder.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model-builder.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-plugin-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-repository-metadata.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings-builder.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-cipher.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-classworlds.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-component-annotations.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-container-default.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-interpolation.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-sec-dispatcher.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-utils.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-resolver.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-validation-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-wagon-provider-api.txt delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-xmlbeans.txt rename dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/{DruidConnectionProvider.java => HikariConnectionProvider.java} (78%) delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/DolphinSchedulerPlugin.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannelFactory.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertData.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertInfo.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertResult.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/ShowType.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/classloader/ThreadContextClassLoader.java rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi}/datasource/BaseConnectionParam.java (67%) rename {dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common => dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi}/datasource/ConnectionParam.java (94%) rename dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/{alert/AlertChannel.java => datasource/DataSourceChannel.java} (81%) rename dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/ConnectionParam.java => dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannelFactory.java (76%) rename dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/{alert/AlertConstants.java => datasource/DataSourceClient.java} (80%) delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/AbstractDolphinPluginManager.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginClassLoader.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginDiscovery.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginLoader.java delete mode 100644 dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginManagerConfig.java rename dolphinscheduler-alert/src/main/resources/alert.properties => dolphinscheduler-standalone-server/src/main/resources/application-h2.properties (51%) delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/AbstractDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseDataSourceParamDTO.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceUtil.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/HiveConfUtils.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickhouseConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2ConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerConnectionParam.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceProcessor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskPlugin.java delete mode 100644 dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskPlugin.java diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9def4bee11..ec6c33caee 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,6 +15,7 @@ # limitations under the License. # +dolphinscheduler/dolphinscheduler-alert @kezhenxu94 dolphinscheduler/dolphinscheduler-e2e @kezhenxu94 dolphinscheduler/dolphinscheduler-registry @kezhenxu94 dolphinscheduler/dolphinscheduler-standalone-server @kezhenxu94 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index daf24fc7cc..c20632d251 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -55,13 +55,6 @@ jobs: with: path: ~/.m2/repository key: ${{ runner.os }}-maven - - name: Bootstrap database - run: | - sed -i "/image: bitnami\/postgresql/a\ ports:\n - 5432:5432" $(pwd)/docker/docker-swarm/docker-compose.yml - sed -i "/image: bitnami\/zookeeper/a\ ports:\n - 2181:2181" $(pwd)/docker/docker-swarm/docker-compose.yml - docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml up -d dolphinscheduler-zookeeper dolphinscheduler-postgresql - until docker logs docker-swarm_dolphinscheduler-postgresql_1 2>&1 | grep 'listening on IPv4 address'; do echo "waiting for postgresql ready ..."; sleep 1; done - docker run --rm --network docker-swarm_dolphinscheduler -v $(pwd)/sql/dolphinscheduler_postgre.sql:/docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql bitnami/postgresql:11.11.0 bash -c "PGPASSWORD=root psql -h docker-swarm_dolphinscheduler-postgresql_1 -U root -d dolphinscheduler -v ON_ERROR_STOP=1 -f /docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql" - name: Run Unit tests run: ./mvnw clean verify -B -Dmaven.test.skip=false diff --git a/.licenserc.yaml b/.licenserc.yaml index b82839bb18..aabeaf6ca6 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -28,7 +28,7 @@ header: - dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/ScriptRunner.java - dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CodeGenerateUtils.java - mvnw.cmd - - sql/soft_version + - dolphinscheduler-dao/src/main/resources/sql/soft_version - .mvn - .gitattributes - '**/licenses/**/LICENSE-*' diff --git a/docker/build/conf/dolphinscheduler/alert.properties.tpl b/docker/build/conf/dolphinscheduler/alert.properties.tpl deleted file mode 100644 index 1ff6fe7adb..0000000000 --- a/docker/build/conf/dolphinscheduler/alert.properties.tpl +++ /dev/null @@ -1,30 +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. -# - -#This configuration file configures the configuration parameters related to the AlertServer. -#These parameters are only related to the AlertServer, and it has nothing to do with the specific Alert Plugin. -#eg : max retry num. -#eg : Alert Server Listener port - -#alert.plugin.dir config the Alert Plugin dir . AlertServer while find and load the Alert Plugin Jar from this dir when deploy and start AlertServer on the server . -alert.plugin.dir=${ALERT_PLUGIN_DIR} - -#maven.local.repository=/Users/gaojun/Documents/jianguoyun/localRepository - -#alert.plugin.binding config the Alert Plugin need be load when development and run in IDE -#alert.plugin.binding=\ -# ./dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml diff --git a/docker/build/conf/dolphinscheduler/quartz.properties.tpl b/docker/build/conf/dolphinscheduler/quartz.properties.tpl index 10f18122bf..45c61a653f 100644 --- a/docker/build/conf/dolphinscheduler/quartz.properties.tpl +++ b/docker/build/conf/dolphinscheduler/quartz.properties.tpl @@ -51,4 +51,4 @@ #============================================================================ # Configure Datasources #============================================================================ -#org.quartz.dataSource.myDs.connectionProvider.class = org.apache.dolphinscheduler.service.quartz.DruidConnectionProvider +#org.quartz.dataSource.myDs.connectionProvider.class = org.apache.dolphinscheduler.service.quartz.HikariConnectionProvider diff --git a/docker/build/startup-init-conf.sh b/docker/build/startup-init-conf.sh index 47178341c0..23f5cfffac 100755 --- a/docker/build/startup-init-conf.sh +++ b/docker/build/startup-init-conf.sh @@ -107,7 +107,6 @@ export ALERT_LISTEN_HOST=${ALERT_LISTEN_HOST:-"localhost"} # Alert Server #============================================================================ export ALERT_SERVER_OPTS=${ALERT_SERVER_OPTS:-"-Xms512m -Xmx512m -Xmn256m"} -export ALERT_PLUGIN_DIR=${ALERT_PLUGIN_DIR:-"lib/plugin/alert"} #============================================================================ # Api Server diff --git a/docker/docker-swarm/config.env.sh b/docker/docker-swarm/config.env.sh index 0c79a045a2..4127102e35 100755 --- a/docker/docker-swarm/config.env.sh +++ b/docker/docker-swarm/config.env.sh @@ -109,7 +109,6 @@ ALERT_LISTEN_HOST=dolphinscheduler-alert # Alert Server #============================================================================ ALERT_SERVER_OPTS=-Xms512m -Xmx512m -Xmn256m -ALERT_PLUGIN_DIR=lib/plugin/alert #============================================================================ # Api Server diff --git a/docker/kubernetes/dolphinscheduler/values.yaml b/docker/kubernetes/dolphinscheduler/values.yaml index 4c90cc20de..60ffedd0a6 100644 --- a/docker/kubernetes/dolphinscheduler/values.yaml +++ b/docker/kubernetes/dolphinscheduler/values.yaml @@ -299,7 +299,6 @@ alert: ## Configmap configmap: ALERT_SERVER_OPTS: "-Xms512m -Xmx512m -Xmn256m" - ALERT_PLUGIN_DIR: "lib/plugin/alert" ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml deleted file mode 100644 index 96257e5cbb..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - dolphinscheduler-alert-plugin - org.apache.dolphinscheduler - 2.0.1-SNAPSHOT - - 4.0.0 - - org.apache.dolphinscheduler - dolphinscheduler-alert-dingtalk - dolphinscheduler-plugin - - - - - org.apache.httpcomponents - httpclient - - - com.google.guava - guava - - - - ch.qos.logback - logback-classic - - - - org.slf4j - slf4j-api - - - - com.fasterxml.jackson.core - jackson-annotations - provided - - - - junit - junit - test - - - - org.mockito - mockito-core - jar - test - - - - org.jacoco - org.jacoco.agent - runtime - test - - - - - dolphinscheduler-alert-dingtalk-${project.version} - - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml deleted file mode 100644 index 9d008e57a2..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - dolphinscheduler-alert-plugin - org.apache.dolphinscheduler - 2.0.1-SNAPSHOT - - 4.0.0 - - org.apache.dolphinscheduler - dolphinscheduler-alert-email - - dolphinscheduler-plugin - - - - org.apache.commons - commons-collections4 - - - - org.apache.poi - poi - - - org.apache.poi - poi-ooxml - - - - com.google.guava - guava - - - - ch.qos.logback - logback-classic - - - - org.slf4j - slf4j-api - - - - org.apache.commons - commons-email - - - - com.fasterxml.jackson.core - jackson-annotations - provided - - - - junit - junit - test - - - - org.mockito - mockito-core - jar - test - - - - org.powermock - powermock-module-junit4 - test - - - - org.powermock - powermock-api-mockito2 - test - - - org.mockito - mockito-core - - - - - - org.jacoco - org.jacoco.agent - runtime - test - - - - - dolphinscheduler-alert-email-${project.version} - - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java deleted file mode 100644 index 2eefb4932f..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java +++ /dev/null @@ -1,140 +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.dolphinscheduler.plugin.alert.email; - -import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE; -import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO; -import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE; -import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES; - -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; -import org.apache.dolphinscheduler.spi.params.input.InputParam; -import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; -import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; -import org.apache.dolphinscheduler.spi.params.base.PluginParams; -import org.apache.dolphinscheduler.spi.params.base.Validate; - -import java.util.ArrayList; -import java.util.List; - -/** - * email alert factory - */ -public class EmailAlertChannelFactory implements AlertChannelFactory { - @Override - public String getName() { - return "Email"; - } - - @Override - public List getParams() { - - List paramsList = new ArrayList<>(); - InputParam receivesParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS) - .setPlaceholder("please input receives") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam receiveCcsParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERCCS) - .build(); - - InputParam mailSmtpHost = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_HOST, MailParamsConstants.MAIL_SMTP_HOST) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - InputParam mailSmtpPort = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, MailParamsConstants.MAIL_SMTP_PORT) - .setValue("25") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam mailSender = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SENDER, MailParamsConstants.MAIL_SENDER) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, MailParamsConstants.MAIL_SMTP_AUTH) - .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) - .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) - .setValue(STRING_TRUE) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, MailParamsConstants.MAIL_USER) - .setPlaceholder("if enable use authentication, you need input user") - .build(); - - PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, MailParamsConstants.MAIL_PASSWD) - .setPlaceholder("if enable use authentication, you need input password") - .build(); - - RadioParam enableTls = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE) - .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) - .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) - .setValue(STRING_FALSE) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - RadioParam enableSsl = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, MailParamsConstants.MAIL_SMTP_SSL_ENABLE) - .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) - .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) - .setValue(STRING_FALSE) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - InputParam sslTrust = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, MailParamsConstants.MAIL_SMTP_SSL_TRUST) - .setValue("*") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, AlertConstants.SHOW_TYPE) - .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) - .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) - .addParamsOptions(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)) - .addParamsOptions(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)) - .setValue(ShowType.TABLE.getDescp()) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - paramsList.add(receivesParam); - paramsList.add(receiveCcsParam); - paramsList.add(mailSmtpHost); - paramsList.add(mailSmtpPort); - paramsList.add(mailSender); - paramsList.add(enableSmtpAuth); - paramsList.add(mailUser); - paramsList.add(mailPassword); - paramsList.add(enableTls); - paramsList.add(enableSsl); - paramsList.add(sslTrust); - paramsList.add(showType); - - return paramsList; - } - - @Override - public AlertChannel create() { - return new EmailAlertChannel(); - } -} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java deleted file mode 100644 index 9a87709e9a..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java +++ /dev/null @@ -1,163 +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.dolphinscheduler.plugin.alert.email; - -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.apache.dolphinscheduler.spi.alert.ShowType; -import org.apache.dolphinscheduler.spi.params.input.InputParam; -import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; -import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; -import org.apache.dolphinscheduler.spi.params.base.PluginParams; -import org.apache.dolphinscheduler.spi.params.base.Validate; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Test; - -/** - * EmailAlertChannel Tester. - */ -public class EmailAlertChannelTest { - - /** - * Method: process(AlertInfo info) - */ - @Test - public void testProcess() { - EmailAlertChannel emailAlertChannel = new EmailAlertChannel(); - AlertData alertData = new AlertData(); - LinkedHashMap map1 = new LinkedHashMap<>(); - map1.put("mysql service name", "mysql200"); - map1.put("mysql address", "192.168.xx.xx"); - map1.put("port", "3306"); - map1.put("no index of number", "80"); - map1.put("database client connections", "190"); - List> maps = new ArrayList<>(); - maps.add(0, map1); - String mapjson = JSONUtils.toJsonString(maps); - - alertData.setId(10) - .setContent(mapjson) - .setLog("10") - .setTitle("test"); - AlertInfo alertInfo = new AlertInfo(); - alertInfo.setAlertData(alertData); - Map paramsMap = PluginParamsTransfer.getPluginParamsMap(getEmailAlertParams()); - - alertInfo.setAlertParams(paramsMap); - AlertResult alertResult = emailAlertChannel.process(alertInfo); - Assert.assertNotNull(alertResult); - Assert.assertEquals("false", alertResult.getStatus()); - } - - public String getEmailAlertParams() { - List paramsList = new ArrayList<>(); - InputParam receivesParam = InputParam.newBuilder("receivers", "receivers") - .setValue("540957506@qq.com") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - InputParam mailSmtpHost = InputParam.newBuilder("serverHost", "smtp.host") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("smtp.126.com") - .build(); - - InputParam mailSmtpPort = InputParam.newBuilder("serverPort", "smtp.port") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .setValue("25") - .build(); - - InputParam mailSender = InputParam.newBuilder("sender", "sender") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("dolphinscheduler@126.com") - .build(); - - RadioParam enableSmtpAuth = RadioParam.newBuilder("enableSmtpAuth", "smtp.auth") - .addParamsOptions(new ParamsOptions("YES", "true", false)) - .addParamsOptions(new ParamsOptions("NO", "false", false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("false") - .build(); - - InputParam mailUser = InputParam.newBuilder("user", "user") - .setPlaceholder("if enable use authentication, you need input user") - .setValue("dolphinscheduler@126.com") - .build(); - - PasswordParam mailPassword = PasswordParam.newBuilder("passwd", "passwd") - .setPlaceholder("if enable use authentication, you need input password") - .setValue("escheduler123") - .build(); - - RadioParam enableTls = RadioParam.newBuilder("starttlsEnable", "starttls.enable") - .addParamsOptions(new ParamsOptions("YES", "true", false)) - .addParamsOptions(new ParamsOptions("NO", "false", false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("true") - .build(); - - RadioParam enableSsl = RadioParam.newBuilder("sslEnable", "smtp.ssl.enable") - .addParamsOptions(new ParamsOptions("YES", "true", false)) - .addParamsOptions(new ParamsOptions("NO", "false", false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("true") - .build(); - - InputParam sslTrust = InputParam.newBuilder("smtpSslTrust", "smtp.ssl.trust") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("smtp.126.com") - .build(); - - List emailShowTypeList = new ArrayList<>(); - emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)); - emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)); - emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)); - emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)); - RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType") - .setOptions(emailShowTypeList) - .setValue(ShowType.TABLE.getDescp()) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - paramsList.add(receivesParam); - paramsList.add(mailSmtpHost); - paramsList.add(mailSmtpPort); - paramsList.add(mailSender); - paramsList.add(enableSmtpAuth); - paramsList.add(mailUser); - paramsList.add(mailPassword); - paramsList.add(enableTls); - paramsList.add(enableSsl); - paramsList.add(sslTrust); - paramsList.add(showType); - - return JSONUtils.toJsonString(paramsList); - } -} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java deleted file mode 100644 index d54885eb7f..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java +++ /dev/null @@ -1,78 +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.dolphinscheduler.plugin.alert.http; - -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.params.input.InputParam; -import org.apache.dolphinscheduler.spi.params.base.PluginParams; -import org.apache.dolphinscheduler.spi.params.base.Validate; - -import java.util.Arrays; -import java.util.List; - -/** - * http alert factory - */ -public class HttpAlertChannelFactory implements AlertChannelFactory { - @Override - public String getName() { - return "Http"; - } - - @Override - public List getParams() { - - InputParam url = InputParam.newBuilder(HttpAlertConstants.URL, HttpAlertConstants.URL) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam contentField = InputParam.newBuilder(HttpAlertConstants.CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam requestType = InputParam.newBuilder(HttpAlertConstants.REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - return Arrays.asList(url, requestType, headerParams, bodyParams, contentField); - } - - @Override - public AlertChannel create() { - return new HttpAlertChannel(); - } -} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPluginTest.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPluginTest.java deleted file mode 100644 index 5086352a46..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPluginTest.java +++ /dev/null @@ -1,36 +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.dolphinscheduler.plugin.alert.slack; - -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; - -import org.junit.Assert; -import org.junit.Test; - -public class SlackAlertPluginTest { - - private SlackAlertPlugin slackAlertPlugin = new SlackAlertPlugin(); - - @Test - public void testGetAlertChannelFactorys() { - Iterable alertChannelFactorys = slackAlertPlugin.getAlertChannelFactorys(); - for (AlertChannelFactory alertChannelFactory : alertChannelFactorys) { - Assert.assertTrue(alertChannelFactory instanceof SlackAlertChannelFactory); - } - } -} \ No newline at end of file diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml deleted file mode 100644 index 8d8ad43473..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - dolphinscheduler-alert-plugin - org.apache.dolphinscheduler - 2.0.1-SNAPSHOT - - 4.0.0 - - org.apache.dolphinscheduler - dolphinscheduler-alert-wechat - dolphinscheduler-plugin - - - - com.google.guava - guava - - - - ch.qos.logback - logback-classic - - - - org.apache.httpcomponents - httpclient - - - - com.fasterxml.jackson.core - jackson-databind - provided - - - - junit - junit - test - - - - org.mockito - mockito-core - jar - test - - - - org.jacoco - org.jacoco.agent - runtime - test - - - - - - dolphinscheduler-alert-wechat-${project.version} - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java deleted file mode 100644 index 25b1318f42..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java +++ /dev/null @@ -1,94 +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.dolphinscheduler.plugin.alert.wechat; - -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; -import org.apache.dolphinscheduler.spi.params.input.InputParam; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; -import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; -import org.apache.dolphinscheduler.spi.params.base.PluginParams; -import org.apache.dolphinscheduler.spi.params.base.Validate; - -import java.util.Arrays; -import java.util.List; - -/** - * WeChatAlertChannelFactory - */ -public class WeChatAlertChannelFactory implements AlertChannelFactory { - - @Override - public String getName() { - return "WeChat"; - } - - @Override - public List getParams() { - InputParam corpIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_CORP_ID) - .setPlaceholder("please input corp id ") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam secretParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET) - .setPlaceholder("please input secret ") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam usersParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS) - .setPlaceholder("please input users ") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam userSendMsgParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USER_SEND_MSG) - .setPlaceholder("please input corp id ") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - InputParam agentIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_AGENT_ID) - .setPlaceholder("please input agent id ") - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); - - RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, AlertConstants.SHOW_TYPE) - .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) - .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) - .setValue(ShowType.TABLE.getDescp()) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); - - return Arrays.asList(corpIdParam, secretParam, usersParam, userSendMsgParam, agentIdParam, showType); - } - - @Override - public AlertChannel create() { - return new WeChatAlertChannel(); - } -} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertPlugin.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertPlugin.java deleted file mode 100644 index 56c3c01f20..0000000000 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertPlugin.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.alert.wechat; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; - -import com.google.common.collect.ImmutableList; - -/** - * WeChatAlertPlugin - */ -public class WeChatAlertPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new WeChatAlertChannelFactory()); - } -} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-api/pom.xml new file mode 100644 index 0000000000..c678bcd003 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/pom.xml @@ -0,0 +1,38 @@ + + + + + + dolphinscheduler-alert + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-api + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + + + diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java new file mode 100644 index 0000000000..fceff92d49 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java @@ -0,0 +1,24 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +public interface AlertChannel { + AlertResult process(AlertInfo info); +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java new file mode 100644 index 0000000000..a55c7ffa4d --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java @@ -0,0 +1,35 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +import org.apache.dolphinscheduler.spi.params.base.PluginParams; + +import java.util.List; + +public interface AlertChannelFactory { + String name(); + + AlertChannel create(); + + /** + * Returns the configurable parameters that this plugin needs to display on the web ui + */ + List params(); +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java new file mode 100644 index 0000000000..9d85fd24bf --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertConstants.java @@ -0,0 +1,33 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +public final class AlertConstants { + /** + * the field name of alert show type + **/ + public static final String SHOW_TYPE = "$t('showType')"; + + public static final String NAME_SHOW_TYPE = "showType"; + + private AlertConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java new file mode 100644 index 0000000000..9d1db84779 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java @@ -0,0 +1,168 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +public class AlertData { + private int id; + private String title; + private String content; + private String log; + + public AlertData(int id, String title, String content, String log) { + this.id = id; + this.title = title; + this.content = content; + this.log = log; + } + + public AlertData() { + } + + public static AlertDataBuilder builder() { + return new AlertDataBuilder(); + } + + public int getId() { + return this.id; + } + + public AlertData setId(int id) { + this.id = id; + return this; + } + + public String getTitle() { + return this.title; + } + + public AlertData setTitle(String title) { + this.title = title; + return this; + } + + public String getContent() { + return this.content; + } + + public AlertData setContent(String content) { + this.content = content; + return this; + } + + public String getLog() { + return this.log; + } + + public AlertData setLog(String log) { + this.log = log; + return this; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof AlertData)) { + return false; + } + final AlertData other = (AlertData) o; + if (!other.canEqual((Object) this)) { + return false; + } + if (this.getId() != other.getId()) { + return false; + } + final Object this$title = this.getTitle(); + final Object other$title = other.getTitle(); + if (this$title == null ? other$title != null : !this$title.equals(other$title)) { + return false; + } + final Object this$content = this.getContent(); + final Object other$content = other.getContent(); + if (this$content == null ? other$content != null : !this$content.equals(other$content)) { + return false; + } + final Object this$log = this.getLog(); + final Object other$log = other.getLog(); + if (this$log == null ? other$log != null : !this$log.equals(other$log)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof AlertData; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getId(); + final Object $title = this.getTitle(); + result = result * PRIME + ($title == null ? 43 : $title.hashCode()); + final Object $content = this.getContent(); + result = result * PRIME + ($content == null ? 43 : $content.hashCode()); + final Object $log = this.getLog(); + result = result * PRIME + ($log == null ? 43 : $log.hashCode()); + return result; + } + + public String toString() { + return "AlertData(id=" + this.getId() + ", title=" + this.getTitle() + ", content=" + this.getContent() + ", log=" + this.getLog() + ")"; + } + + public static class AlertDataBuilder { + private int id; + private String title; + private String content; + private String log; + + AlertDataBuilder() { + } + + public AlertDataBuilder id(int id) { + this.id = id; + return this; + } + + public AlertDataBuilder title(String title) { + this.title = title; + return this; + } + + public AlertDataBuilder content(String content) { + this.content = content; + return this; + } + + public AlertDataBuilder log(String log) { + this.log = log; + return this; + } + + public AlertData build() { + return new AlertData(id, title, content, log); + } + + public String toString() { + return "AlertData.AlertDataBuilder(id=" + this.id + ", title=" + this.title + ", content=" + this.content + ", log=" + this.log + ")"; + } + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java new file mode 100644 index 0000000000..6dbc8205e6 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java @@ -0,0 +1,125 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +import java.util.Map; + +public class AlertInfo { + private Map alertParams; + private AlertData alertData; + + public AlertInfo(Map alertParams, AlertData alertData) { + this.alertParams = alertParams; + this.alertData = alertData; + } + + public AlertInfo() { + } + + public static AlertInfoBuilder builder() { + return new AlertInfoBuilder(); + } + + public Map getAlertParams() { + return this.alertParams; + } + + public AlertInfo setAlertParams(Map alertParams) { + this.alertParams = alertParams; + return this; + } + + public AlertData getAlertData() { + return this.alertData; + } + + public AlertInfo setAlertData(AlertData alertData) { + this.alertData = alertData; + return this; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof AlertInfo)) { + return false; + } + final AlertInfo other = (AlertInfo) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$alertParams = this.getAlertParams(); + final Object other$alertParams = other.getAlertParams(); + if (this$alertParams == null ? other$alertParams != null : !this$alertParams.equals(other$alertParams)) { + return false; + } + final Object this$alertData = this.getAlertData(); + final Object other$alertData = other.getAlertData(); + if (this$alertData == null ? other$alertData != null : !this$alertData.equals(other$alertData)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof AlertInfo; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $alertParams = this.getAlertParams(); + result = result * PRIME + ($alertParams == null ? 43 : $alertParams.hashCode()); + final Object $alertData = this.getAlertData(); + result = result * PRIME + ($alertData == null ? 43 : $alertData.hashCode()); + return result; + } + + public String toString() { + return "AlertInfo(alertParams=" + this.getAlertParams() + ", alertData=" + this.getAlertData() + ")"; + } + + public static class AlertInfoBuilder { + private Map alertParams; + private AlertData alertData; + + AlertInfoBuilder() { + } + + public AlertInfoBuilder alertParams(Map alertParams) { + this.alertParams = alertParams; + return this; + } + + public AlertInfoBuilder alertData(AlertData alertData) { + this.alertData = alertData; + return this; + } + + public AlertInfo build() { + return new AlertInfo(alertParams, alertData); + } + + public String toString() { + return "AlertInfo.AlertInfoBuilder(alertParams=" + this.alertParams + ", alertData=" + this.alertData + ")"; + } + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java new file mode 100644 index 0000000000..4343c13408 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java @@ -0,0 +1,123 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +public class AlertResult { + private String status; + private String message; + + public AlertResult(String status, String message) { + this.status = status; + this.message = message; + } + + public AlertResult() { + } + + public static AlertResultBuilder builder() { + return new AlertResultBuilder(); + } + + public String getStatus() { + return this.status; + } + + public AlertResult setStatus(String status) { + this.status = status; + return this; + } + + public String getMessage() { + return this.message; + } + + public AlertResult setMessage(String message) { + this.message = message; + return this; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof AlertResult)) { + return false; + } + final AlertResult other = (AlertResult) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$status = this.getStatus(); + final Object other$status = other.getStatus(); + if (this$status == null ? other$status != null : !this$status.equals(other$status)) { + return false; + } + final Object this$message = this.getMessage(); + final Object other$message = other.getMessage(); + if (this$message == null ? other$message != null : !this$message.equals(other$message)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof AlertResult; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $status = this.getStatus(); + result = result * PRIME + ($status == null ? 43 : $status.hashCode()); + final Object $message = this.getMessage(); + result = result * PRIME + ($message == null ? 43 : $message.hashCode()); + return result; + } + + public String toString() { + return "AlertResult(status=" + this.getStatus() + ", message=" + this.getMessage() + ")"; + } + + public static class AlertResultBuilder { + private String status; + private String message; + + AlertResultBuilder() { + } + + public AlertResultBuilder status(String status) { + this.status = status; + return this; + } + + public AlertResultBuilder message(String message) { + this.message = message; + return this; + } + + public AlertResult build() { + return new AlertResult(status, message); + } + + public String toString() { + return "AlertResult.AlertResultBuilder(status=" + this.status + ", message=" + this.message + ")"; + } + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/ShowType.java b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/ShowType.java new file mode 100644 index 0000000000..48f9877528 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/ShowType.java @@ -0,0 +1,49 @@ +/* + * Licensed to 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. Apache Software Foundation (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.dolphinscheduler.alert.api; + +public enum ShowType { + /** + * 0 TABLE; + * 1 TEXT; + * 2 attachment; + * 3 TABLE+attachment; + */ + TABLE(0, "table"), + TEXT(1, "text"), + ATTACHMENT(2, "attachment"), + TABLEATTACHMENT(3, "table attachment"); + + private final int code; + private final String descp; + + ShowType(int code, String descp) { + this.code = code; + this.descp = descp; + } + + public int getCode() { + return code; + } + + public String getDescp() { + return descp; + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/pom.xml new file mode 100644 index 0000000000..6dd1cc1177 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/pom.xml @@ -0,0 +1,41 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-dingtalk + jar + + + + org.apache.httpcomponents + httpclient + + + + com.google.guava + guava + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java similarity index 80% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java index 6b13f24d86..74c440fe76 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannel.java @@ -17,21 +17,17 @@ package org.apache.dolphinscheduler.plugin.alert.dingtalk; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -/** - * DingTalkAlertChannel - */ -public class DingTalkAlertChannel implements AlertChannel { +public final class DingTalkAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo alertInfo) { - AlertData alertData = alertInfo.getAlertData(); Map paramsMap = alertInfo.getAlertParams(); if (null == paramsMap) { diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java similarity index 57% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java index 61518b6cbf..27d95e7c67 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java @@ -22,67 +22,67 @@ import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO; import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; -/** - * DingTalkAlertChannelFactory - */ -public class DingTalkAlertChannelFactory implements AlertChannelFactory { +import com.google.auto.service.AutoService; + +@AutoService(AlertChannelFactory.class) +public final class DingTalkAlertChannelFactory implements AlertChannelFactory { @Override - public String getName() { + public String name() { return "DingTalk"; } @Override - public List getParams() { + public List params() { InputParam webHookParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_WEB_HOOK, DingTalkParamsConstants.DING_TALK_WEB_HOOK) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); InputParam keywordParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_KEYWORD, DingTalkParamsConstants.DING_TALK_KEYWORD) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); RadioParam isEnableProxy = - RadioParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE) - .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) - .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) - .setValue(STRING_TRUE) - .addValidate(Validate.newBuilder() - .setRequired(false) - .build()) - .build(); + RadioParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, DingTalkParamsConstants.DING_TALK_PROXY_ENABLE) + .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) + .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) + .setValue(STRING_TRUE) + .addValidate(Validate.newBuilder() + .setRequired(false) + .build()) + .build(); InputParam proxyParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PROXY, DingTalkParamsConstants.DING_TALK_PROXY) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); InputParam portParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PORT, DingTalkParamsConstants.DING_TALK_PORT) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); InputParam userParam = InputParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_USER, DingTalkParamsConstants.DING_TALK_USER) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); PasswordParam passwordParam = PasswordParam.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD, DingTalkParamsConstants.DING_TALK_PASSWORD) - .setPlaceholder("if enable use authentication, you need input password") - .build(); + .setPlaceholder("if enable use authentication, you need input password") + .build(); return Arrays.asList(webHookParam, keywordParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java similarity index 69% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java index e94da80f20..ec0003a94f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java @@ -17,29 +17,29 @@ package org.apache.dolphinscheduler.plugin.alert.dingtalk; -/** - * DingTalkParamsConstants - */ -public class DingTalkParamsConstants { - +public final class DingTalkParamsConstants { + static final String DING_TALK_PROXY_ENABLE = "$t('isEnableProxy')"; + static final String NAME_DING_TALK_PROXY_ENABLE = "IsEnableProxy"; - static final String DING_TALK_PROXY_ENABLE = "isEnableProxy"; - static final String DING_TALK_WEB_HOOK = "webhook"; + static final String DING_TALK_WEB_HOOK = "$t('webhook')"; static final String NAME_DING_TALK_WEB_HOOK = "WebHook"; - static final String DING_TALK_KEYWORD = "keyword"; + + static final String DING_TALK_KEYWORD = "$t('keyword')"; static final String NAME_DING_TALK_KEYWORD = "Keyword"; - static final String NAME_DING_TALK_PROXY_ENABLE = "IsEnableProxy"; - static final String DING_TALK_PROXY = "proxy"; + + static final String DING_TALK_PROXY = "$t('proxy')"; static final String NAME_DING_TALK_PROXY = "Proxy"; - static final String DING_TALK_PORT = "port"; + + static final String DING_TALK_PORT = "$t('port')"; static final String NAME_DING_TALK_PORT = "Port"; - static final String DING_TALK_USER = "user"; + + static final String DING_TALK_USER = "$t('user')"; static final String NAME_DING_TALK_USER = "User"; - static final String DING_TALK_PASSWORD = "password"; + + static final String DING_TALK_PASSWORD = "$t('password')"; static final String NAME_DING_TALK_PASSWORD = "Password"; private DingTalkParamsConstants() { - throw new IllegalStateException("Utility class"); + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } - } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java similarity index 72% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java index 0d87e4779a..a97fb006eb 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.dingtalk; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.codec.binary.StringUtils; @@ -36,23 +36,17 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * Ding Talk Sender - */ -public class DingTalkSender { - private static final Logger logger = LoggerFactory.getLogger(DingTalkSender.class); - - private String url; - - private String keyword; - - private Boolean enableProxy; +public final class DingTalkSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(DingTalkSender.class); + private final String url; + private final String keyword; + private final Boolean enableProxy; private String proxy; @@ -72,12 +66,11 @@ public class DingTalkSender { user = config.get(DingTalkParamsConstants.DING_TALK_USER); password = config.get(DingTalkParamsConstants.NAME_DING_TALK_PASSWORD); } - } - private static HttpPost constructHttpPost(String url, String msg, String charset) { + private static HttpPost constructHttpPost(String url, String msg) { HttpPost post = new HttpPost(url); - StringEntity entity = new StringEntity(msg, charset); + StringEntity entity = new StringEntity(msg, StandardCharsets.UTF_8); post.setEntity(entity); post.addHeader("Content-Type", "application/json; charset=utf-8"); return post; @@ -116,13 +109,13 @@ public class DingTalkSender { if (null == result) { alertResult.setMessage("send ding talk msg error"); - logger.info("send ding talk msg error,ding talk server resp is null"); + log.info("send ding talk msg error,ding talk server resp is null"); return alertResult; } DingTalkSendMsgResponse sendMsgResponse = JSONUtils.parseObject(result, DingTalkSendMsgResponse.class); if (null == sendMsgResponse) { alertResult.setMessage("send ding talk msg fail"); - logger.info("send ding talk msg error,resp error"); + log.info("send ding talk msg error,resp error"); return alertResult; } if (sendMsgResponse.errcode == 0) { @@ -131,7 +124,7 @@ public class DingTalkSender { return alertResult; } alertResult.setMessage(String.format("alert send ding talk msg error : %s", sendMsgResponse.getErrmsg())); - logger.info("alert send ding talk msg error : {}", sendMsgResponse.getErrmsg()); + log.info("alert send ding talk msg error : {}", sendMsgResponse.getErrmsg()); return alertResult; } @@ -141,7 +134,7 @@ public class DingTalkSender { String resp = sendMsg(title, content); return checkSendDingTalkSendMsgResult(resp); } catch (Exception e) { - logger.info("send ding talk alert msg exception : {}", e.getMessage()); + log.info("send ding talk alert msg exception : {}", e.getMessage()); alertResult = new AlertResult(); alertResult.setStatus("false"); alertResult.setMessage("send ding talk alert fail."); @@ -152,7 +145,7 @@ public class DingTalkSender { private String sendMsg(String title, String content) throws IOException { String msgToJson = textToJsonString(title + content + "#" + keyword); - HttpPost httpPost = constructHttpPost(url, msgToJson, "UTF-8"); + HttpPost httpPost = constructHttpPost(url, msgToJson); CloseableHttpClient httpClient; if (Boolean.TRUE.equals(enableProxy)) { @@ -173,19 +166,22 @@ public class DingTalkSender { } finally { response.close(); } - logger.info("Ding Talk send title :{},content : {}, resp: {}", title, content, resp); + log.info("Ding Talk send title :{},content : {}, resp: {}", title, content, resp); return resp; } finally { httpClient.close(); } } - public static class DingTalkSendMsgResponse { + static final class DingTalkSendMsgResponse { private Integer errcode; private String errmsg; + public DingTalkSendMsgResponse() { + } + public Integer getErrcode() { - return errcode; + return this.errcode; } public void setErrcode(Integer errcode) { @@ -193,12 +189,46 @@ public class DingTalkSender { } public String getErrmsg() { - return errmsg; + return this.errmsg; } public void setErrmsg(String errmsg) { this.errmsg = errmsg; } - } + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DingTalkSendMsgResponse)) { + return false; + } + final DingTalkSendMsgResponse other = (DingTalkSendMsgResponse) o; + final Object this$errcode = this.getErrcode(); + final Object other$errcode = other.getErrcode(); + if (this$errcode == null ? other$errcode != null : !this$errcode.equals(other$errcode)) { + return false; + } + final Object this$errmsg = this.getErrmsg(); + final Object other$errmsg = other.getErrmsg(); + if (this$errmsg == null ? other$errmsg != null : !this$errmsg.equals(other$errmsg)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $errcode = this.getErrcode(); + result = result * PRIME + ($errcode == null ? 43 : $errcode.hashCode()); + final Object $errmsg = this.getErrmsg(); + result = result * PRIME + ($errmsg == null ? 43 : $errmsg.hashCode()); + return result; + } + + public String toString() { + return "DingTalkSender.DingTalkSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")"; + } + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java similarity index 91% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java index 7c25f1ebf0..8b780427fc 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java @@ -17,26 +17,20 @@ package org.apache.dolphinscheduler.plugin.alert.dingtalk; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.List; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; -/** - * DingTalkAlertChannelFactoryTest - */ -@Ignore public class DingTalkAlertChannelFactoryTest { - @Test public void testGetParams() { DingTalkAlertChannelFactory dingTalkAlertChannelFactory = new DingTalkAlertChannelFactory(); - List params = dingTalkAlertChannelFactory.getParams(); + List params = dingTalkAlertChannelFactory.params(); JSONUtils.toJsonString(params); Assert.assertEquals(7, params.size()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java similarity index 90% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java index bc17d4185b..d2267a4919 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/test/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSenderTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.dingtalk; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.HashMap; import java.util.Map; @@ -26,12 +26,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -/** - * DingTalkSenderTest - */ public class DingTalkSenderTest { - private static Map dingTalkConfig = new HashMap<>(); + private static final Map dingTalkConfig = new HashMap<>(); @Before public void initDingTalkConfig() { @@ -51,7 +48,7 @@ public class DingTalkSenderTest { dingTalkConfig.put(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE, "true"); dingTalkSender = new DingTalkSender(dingTalkConfig); AlertResult alertResult = dingTalkSender.sendDingTalkMsg("title", "content test"); - Assert.assertEquals("false",alertResult.getStatus()); + Assert.assertEquals("false", alertResult.getStatus()); } } diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/pom.xml new file mode 100644 index 0000000000..07f959f616 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/pom.xml @@ -0,0 +1,50 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-email + jar + + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + + com.google.guava + guava + + + + org.apache.commons + commons-email + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java similarity index 71% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java index 3dbf0b8fb9..c5cdc333fd 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannel.java @@ -17,21 +17,17 @@ package org.apache.dolphinscheduler.plugin.alert.email; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * email alert channel . use email to seed the alertInfo - */ -public class EmailAlertChannel implements AlertChannel { - private static final Logger logger = LoggerFactory.getLogger(EmailAlertChannel.class); +public final class EmailAlertChannel implements AlertChannel { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(EmailAlertChannel.class); @Override public AlertResult process(AlertInfo info) { @@ -44,25 +40,24 @@ public class EmailAlertChannel implements AlertChannel { MailSender mailSender = new MailSender(paramsMap); AlertResult alertResult = mailSender.sendMails(alert.getTitle(), alert.getContent()); - //send flag - boolean flag = false; + boolean flag; if (alertResult == null) { alertResult = new AlertResult(); alertResult.setStatus("false"); alertResult.setMessage("alert send error."); - logger.info("alert send error : {}", alertResult.getMessage()); + log.info("alert send error : {}", alertResult.getMessage()); return alertResult; } flag = Boolean.parseBoolean(String.valueOf(alertResult.getStatus())); if (flag) { - logger.info("alert send success"); + log.info("alert send success"); alertResult.setMessage("email send success."); } else { alertResult.setMessage("alert send error."); - logger.info("alert send error : {}", alertResult.getMessage()); + log.info("alert send error : {}", alertResult.getMessage()); } return alertResult; diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java new file mode 100644 index 0000000000..a2c5261877 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java @@ -0,0 +1,139 @@ +/* + * 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.dolphinscheduler.plugin.alert.email; + +import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_FALSE; +import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO; +import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE; +import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES; + +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.ShowType; +import org.apache.dolphinscheduler.spi.params.PasswordParam; +import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; + +import java.util.ArrayList; +import java.util.List; + +import com.google.auto.service.AutoService; + +@AutoService(AlertChannelFactory.class) +public final class EmailAlertChannelFactory implements AlertChannelFactory { + @Override + public String name() { + return "Email"; + } + + @Override + public List params() { + List paramsList = new ArrayList<>(); + InputParam receivesParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS) + .setPlaceholder("please input receives") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam receiveCcsParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERCCS) + .build(); + + InputParam mailSmtpHost = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_HOST, MailParamsConstants.MAIL_SMTP_HOST) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + InputParam mailSmtpPort = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, MailParamsConstants.MAIL_SMTP_PORT) + .setValue("25") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam mailSender = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SENDER, MailParamsConstants.MAIL_SENDER) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, MailParamsConstants.MAIL_SMTP_AUTH) + .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) + .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) + .setValue(STRING_TRUE) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, MailParamsConstants.MAIL_USER) + .setPlaceholder("if enable use authentication, you need input user") + .build(); + + PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, MailParamsConstants.MAIL_PASSWD) + .setPlaceholder("if enable use authentication, you need input password") + .build(); + + RadioParam enableTls = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE) + .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) + .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) + .setValue(STRING_FALSE) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + RadioParam enableSsl = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, MailParamsConstants.MAIL_SMTP_SSL_ENABLE) + .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) + .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) + .setValue(STRING_FALSE) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + InputParam sslTrust = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, MailParamsConstants.MAIL_SMTP_SSL_TRUST) + .setValue("*") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, AlertConstants.SHOW_TYPE) + .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) + .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) + .addParamsOptions(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)) + .addParamsOptions(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)) + .setValue(ShowType.TABLE.getDescp()) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + paramsList.add(receivesParam); + paramsList.add(receiveCcsParam); + paramsList.add(mailSmtpHost); + paramsList.add(mailSmtpPort); + paramsList.add(mailSender); + paramsList.add(enableSmtpAuth); + paramsList.add(mailUser); + paramsList.add(mailPassword); + paramsList.add(enableTls); + paramsList.add(enableSsl); + paramsList.add(sslTrust); + paramsList.add(showType); + + return paramsList; + } + + @Override + public AlertChannel create() { + return new EmailAlertChannel(); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java similarity index 52% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java index 5eecaa07a7..4c6e1d37ee 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailConstants.java @@ -17,19 +17,11 @@ package org.apache.dolphinscheduler.plugin.alert.email; -public class EmailConstants { - - private EmailConstants() { - throw new IllegalStateException(EmailConstants.class.getName()); - } - - +public final class EmailConstants { public static final String XLS_FILE_PATH = "xls.file.path"; public static final String MAIL_TRANSPORT_PROTOCOL = "mail.transport.protocol"; - public static final String DEFAULT_SMTP_PORT = "25"; - public static final String TEXT_HTML_CHARSET_UTF_8 = "text/html;charset=utf-8"; public static final int NUMBER_1000 = 1000; @@ -42,32 +34,23 @@ public class EmailConstants { public static final String TR_END = ""; - public static final String TITLE = "title"; - - public static final String CONTENT = "content"; - public static final String TH = ""; public static final String TH_END = ""; - public static final String MARKDOWN_QUOTE = ">"; - - public static final String MARKDOWN_ENTER = "\n"; - - public static final String HTML_HEADER_PREFIX = new StringBuilder("") - .append("") - .append("") - .append("dolphinscheduler") - .append("") - .append("") - .append("") - .append("") - .append(" ") - .toString(); + public static final String HTML_HEADER_PREFIX = "" + + "" + + "" + + "dolphinscheduler" + + "" + + "" + + "" + + "" + + "
"; public static final String TABLE_BODY_HTML_TAIL = "
"; @@ -76,4 +59,8 @@ public class EmailConstants { public static final String EXCEL_SUFFIX_XLSX = ".xlsx"; public static final String SINGLE_SLASH = "/"; + + private EmailConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java similarity index 92% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java index 90069c6e07..1986f1c08f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtils.java @@ -36,21 +36,15 @@ import java.util.List; import java.util.Map; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * excel utils - */ -public class ExcelUtils { +public final class ExcelUtils { + private static final int XLSX_WINDOW_ROW = 10000; + private static final Logger log = org.slf4j.LoggerFactory.getLogger(ExcelUtils.class); private ExcelUtils() { - throw new IllegalStateException("Utility class"); + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } - private static final Logger logger = LoggerFactory.getLogger(ExcelUtils.class); - - private static final int XLSX_WINDOW_ROW = 10000; - /** * generate excel file * @@ -61,14 +55,14 @@ public class ExcelUtils { public static void genExcelFile(String content, String title, String xlsFilePath) { File file = new File(xlsFilePath); if (!file.exists() && !file.mkdirs()) { - logger.error("Create xlsx directory error, path:{}", xlsFilePath); + log.error("Create xlsx directory error, path:{}", xlsFilePath); throw new AlertEmailException("Create xlsx directory error"); } List itemsList = JSONUtils.toList(content, LinkedHashMap.class); if (CollectionUtils.isEmpty(itemsList)) { - logger.error("itemsList is null"); + log.error("itemsList is null"); throw new AlertEmailException("itemsList is null"); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java similarity index 66% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java index 9b49b4705b..7bd75b841e 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java @@ -17,49 +17,43 @@ package org.apache.dolphinscheduler.plugin.alert.email; -/** - * mail plugin params json use - */ -public class MailParamsConstants { - - private MailParamsConstants() { - throw new IllegalStateException("Utility class"); - } - +public final class MailParamsConstants { public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERS = "$t('receivers')"; public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS = "receivers"; public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "$t('receiverCcs')"; public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs"; - public static final String MAIL_PROTOCOL = "transport.protocol"; public static final String NAME_MAIL_PROTOCOL = "mail.protocol"; - public static final String MAIL_SMTP_HOST = "mail.smtp.host"; + public static final String MAIL_SMTP_HOST = "$t('mailSmtpHost')"; public static final String NAME_MAIL_SMTP_HOST = "serverHost"; - public static final String MAIL_SMTP_PORT = "mail.smtp.port"; + public static final String MAIL_SMTP_PORT = "$t('mailSmtpPort')"; public static final String NAME_MAIL_SMTP_PORT = "serverPort"; - public static final String MAIL_SENDER = "mail.sender"; + public static final String MAIL_SENDER = "$t('mailSender')"; public static final String NAME_MAIL_SENDER = "sender"; - public static final String MAIL_SMTP_AUTH = "mail.smtp.auth"; + public static final String MAIL_SMTP_AUTH = "$t('mailSmtpAuth')"; public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth"; - public static final String MAIL_USER = "mail.user"; - public static final String NAME_MAIL_USER = "user"; + public static final String MAIL_USER = "$t('mailUser')"; + public static final String NAME_MAIL_USER = "User"; - public static final String MAIL_PASSWD = "mail.passwd"; - public static final String NAME_MAIL_PASSWD = "passwd"; + public static final String MAIL_PASSWD = "$t('mailPasswd')"; + public static final String NAME_MAIL_PASSWD = "Password"; - public static final String MAIL_SMTP_STARTTLS_ENABLE = "mail.smtp.starttls.enable"; + public static final String MAIL_SMTP_STARTTLS_ENABLE = "$t('mailSmtpStarttlsEnable')"; public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable"; - public static final String MAIL_SMTP_SSL_ENABLE = "mail.smtp.ssl.enable"; + public static final String MAIL_SMTP_SSL_ENABLE = "$t('mailSmtpSslEnable')"; public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable"; - public static final String MAIL_SMTP_SSL_TRUST = "mail.smtp.ssl.trust"; + public static final String MAIL_SMTP_SSL_TRUST = "$t('mailSmtpSslTrust')"; public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust"; + private MailParamsConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java similarity index 79% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java index 33701de7bd..ba8acab010 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java @@ -17,76 +17,53 @@ package org.apache.dolphinscheduler.plugin.alert.email; -import static java.util.Objects.requireNonNull; - +import com.sun.mail.smtp.SMTPProvider; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.HtmlEmail; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.AlertResult; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.plugin.alert.email.exception.AlertEmailException; import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate; import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.HtmlEmail; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import org.slf4j.Logger; import javax.activation.CommandMap; import javax.activation.MailcapCommandMap; -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.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; -import javax.mail.internet.MimeUtility; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import javax.mail.*; +import javax.mail.internet.*; +import java.io.File; +import java.io.IOException; +import java.util.*; -import com.sun.mail.smtp.SMTPProvider; +import static java.util.Objects.requireNonNull; -/** - * mail utils - */ -public class MailSender { - - public static final Logger logger = LoggerFactory.getLogger(MailSender.class); - - private List receivers; - private List receiverCcs; - private String mailProtocol = "SMTP"; - private String mailSmtpHost; - private String mailSmtpPort; - private String mailSenderEmail; - private String enableSmtpAuth; - private String mailUser; - private String mailPasswd; - private String mailUseStartTLS; - private String mailUseSSL; +public final class MailSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(MailSender.class); + + private final List receivers; + private final List receiverCcs; + private final String mailProtocol = "SMTP"; + private final String mailSmtpHost; + private final String mailSmtpPort; + private final String mailSenderEmail; + private final String enableSmtpAuth; + private final String mailUser; + private final String mailPasswd; + private final String mailUseStartTLS; + private final String mailUseSSL; + private final String sslTrust; + private final String showType; + private final AlertTemplate alertTemplate; + private final String mustNotNull = " must not be null"; private String xlsFilePath; - private String sslTrust; - private String showType; - private AlertTemplate alertTemplate; - private String mustNotNull = " must not be null"; public MailSender(Map config) { - String receiversConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS); if (receiversConfig == null || "".equals(receiversConfig)) { - throw new AlertEmailException(MailParamsConstants.PLUGIN_DEFAULT_EMAIL_RECEIVERS + mustNotNull); + throw new AlertEmailException(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS + mustNotNull); } receivers = Arrays.asList(receiversConfig.split(",")); @@ -95,37 +72,37 @@ public class MailSender { receiverCcs = new ArrayList<>(); if (receiverCcsConfig != null && !"".equals(receiverCcsConfig)) { - receiverCcs = Arrays.asList(receiverCcsConfig.split(",")); + receiverCcs.addAll(Arrays.asList(receiverCcsConfig.split(","))); } mailSmtpHost = config.get(MailParamsConstants.NAME_MAIL_SMTP_HOST); - requireNonNull(mailSmtpHost, MailParamsConstants.MAIL_SMTP_HOST + mustNotNull); + requireNonNull(mailSmtpHost, MailParamsConstants.NAME_MAIL_SMTP_HOST + mustNotNull); mailSmtpPort = config.get(MailParamsConstants.NAME_MAIL_SMTP_PORT); - requireNonNull(mailSmtpPort, MailParamsConstants.MAIL_SMTP_PORT + mustNotNull); + requireNonNull(mailSmtpPort, MailParamsConstants.NAME_MAIL_SMTP_PORT + mustNotNull); mailSenderEmail = config.get(MailParamsConstants.NAME_MAIL_SENDER); - requireNonNull(mailSenderEmail, MailParamsConstants.MAIL_SENDER + mustNotNull); + requireNonNull(mailSenderEmail, MailParamsConstants.NAME_MAIL_SENDER + mustNotNull); enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH); mailUser = config.get(MailParamsConstants.NAME_MAIL_USER); - requireNonNull(mailUser, MailParamsConstants.MAIL_USER + mustNotNull); + requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull); mailPasswd = config.get(MailParamsConstants.NAME_MAIL_PASSWD); - requireNonNull(mailPasswd, MailParamsConstants.MAIL_PASSWD + mustNotNull); + requireNonNull(mailPasswd, MailParamsConstants.NAME_MAIL_PASSWD + mustNotNull); mailUseStartTLS = config.get(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE); - requireNonNull(mailUseStartTLS, MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE + mustNotNull); + requireNonNull(mailUseStartTLS, MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE + mustNotNull); mailUseSSL = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE); - requireNonNull(mailUseSSL, MailParamsConstants.MAIL_SMTP_SSL_ENABLE + mustNotNull); + requireNonNull(mailUseSSL, MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE + mustNotNull); sslTrust = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST); - requireNonNull(sslTrust, MailParamsConstants.MAIL_SMTP_SSL_TRUST + mustNotNull); + requireNonNull(sslTrust, MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST + mustNotNull); - showType = config.get(AlertConstants.SHOW_TYPE); - requireNonNull(showType, AlertConstants.SHOW_TYPE + mustNotNull); + showType = config.get(AlertConstants.NAME_SHOW_TYPE); + requireNonNull(showType, AlertConstants.NAME_SHOW_TYPE + mustNotNull); xlsFilePath = config.get(EmailConstants.XLS_FILE_PATH); if (StringUtils.isBlank(xlsFilePath)) { @@ -145,16 +122,6 @@ public class MailSender { return sendMails(this.receivers, this.receiverCcs, title, content); } - /** - * send mail to receivers - * - * @param title email title - * @param content email content - */ - public AlertResult sendMailsToReceiverOnly(String title, String content) { - return sendMails(this.receivers, null, title, content); - } - /** * send mail * @@ -206,8 +173,8 @@ public class MailSender { try { String partContent = (showType.equals(ShowType.ATTACHMENT.getDescp()) - ? "Please see the attachment " + title + EmailConstants.EXCEL_SUFFIX_XLSX - : htmlTable(content, false)); + ? "Please see the attachment " + title + EmailConstants.EXCEL_SUFFIX_XLSX + : htmlTable(content, false)); attachment(title, content, partContent); @@ -396,12 +363,12 @@ public class MailSender { public void deleteFile(File file) { if (file.exists()) { if (file.delete()) { - logger.info("delete success: {}", file.getAbsolutePath()); + log.info("delete success: {}", file.getAbsolutePath()); } else { - logger.info("delete fail: {}", file.getAbsolutePath()); + log.info("delete fail: {}", file.getAbsolutePath()); } } else { - logger.info("file not exists: {}", file.getAbsolutePath()); + log.info("file not exists: {}", file.getAbsolutePath()); } } @@ -409,7 +376,7 @@ public class MailSender { * handle exception */ private void handleException(AlertResult alertResult, Exception e) { - logger.error("Send email to {} failed", receivers, e); + log.error("Send email to {} failed", receivers, e); alertResult.setMessage("Send email to {" + String.join(",", receivers) + "} failed," + e.toString()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java similarity index 83% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java index 466ccc06de..5b64d8de1e 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/exception/AlertEmailException.java @@ -18,22 +18,10 @@ package org.apache.dolphinscheduler.plugin.alert.email.exception; public class AlertEmailException extends RuntimeException { - - /** - * Create Runtime exception - * - * @param errMsg - Error message - */ public AlertEmailException(String errMsg) { super(errMsg); } - /** - * Create Runtime exception - * - * @param errMsg - Error message - * @param cause - cause - */ public AlertEmailException(String errMsg, Throwable cause) { super(errMsg, cause); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java similarity index 86% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java index dec993d4d0..7f66e659b4 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/AlertTemplate.java @@ -17,19 +17,16 @@ package org.apache.dolphinscheduler.plugin.alert.email.template; -import org.apache.dolphinscheduler.spi.alert.ShowType; +import org.apache.dolphinscheduler.alert.api.ShowType; -/** - * alert message template - */ public interface AlertTemplate { /** * get a message from a specified alert template * - * @param content alert message content + * @param content alert message content * @param showType show type - * @param showAll whether to show all + * @param showAll whether to show all * @return a message from a specified alert template */ String getMessageFromTemplate(String content, ShowType showType, boolean showAll); @@ -37,7 +34,7 @@ public interface AlertTemplate { /** * default showAll is true * - * @param content alert message content + * @param content alert message content * @param showType show type * @return a message from a specified alert template */ diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java similarity index 95% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java index 57187aa70c..433cfda3f7 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplate.java @@ -19,8 +19,8 @@ package org.apache.dolphinscheduler.plugin.alert.email.template; import static java.util.Objects.requireNonNull; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.plugin.alert.email.EmailConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; @@ -36,9 +36,6 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; -/** - * the default html alert message template - */ public class DefaultHTMLTemplate implements AlertTemplate { public static final Logger logger = LoggerFactory.getLogger(DefaultHTMLTemplate.class); @@ -89,7 +86,7 @@ public class DefaultHTMLTemplate implements AlertTemplate { Map.Entry entry = iterator.next(); t.append(EmailConstants.TH).append(entry.getKey()).append(EmailConstants.TH_END); - cs.append(EmailConstants.TD).append(String.valueOf(entry.getValue())).append(EmailConstants.TD_END); + cs.append(EmailConstants.TD).append(entry.getValue()).append(EmailConstants.TD_END); } t.append(EmailConstants.TR_END); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java similarity index 82% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java index 37a11e47fb..5bb7c1d504 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.email; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import java.util.List; @@ -25,27 +25,14 @@ import java.util.List; import org.junit.Assert; import org.junit.Test; -/** - * EmailAlertChannelFactory Tester. - * - * @version 1.0 - * @since
Aug 20, 2020
- */ public class EmailAlertChannelFactoryTest { - - /** - * Method: getParams() - */ @Test public void testGetParams() { EmailAlertChannelFactory emailAlertChannelFactory = new EmailAlertChannelFactory(); - List params = emailAlertChannelFactory.getParams(); + List params = emailAlertChannelFactory.params(); Assert.assertEquals(12, params.size()); } - /** - * Method: create() - */ @Test public void testCreate() { EmailAlertChannelFactory emailAlertChannelFactory = new EmailAlertChannelFactory(); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java new file mode 100644 index 0000000000..49f67b2ffa --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java @@ -0,0 +1,156 @@ +/* + * 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.dolphinscheduler.plugin.alert.email; + +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; +import org.apache.dolphinscheduler.alert.api.ShowType; +import org.apache.dolphinscheduler.spi.params.PasswordParam; +import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; +import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +public class EmailAlertChannelTest { + @Test + public void testProcess() { + EmailAlertChannel emailAlertChannel = new EmailAlertChannel(); + AlertData alertData = new AlertData(); + LinkedHashMap map1 = new LinkedHashMap<>(); + map1.put("mysql service name", "mysql200"); + map1.put("mysql address", "192.168.xx.xx"); + map1.put("port", "3306"); + map1.put("no index of number", "80"); + map1.put("database client connections", "190"); + List> maps = new ArrayList<>(); + maps.add(0, map1); + String mapjson = JSONUtils.toJsonString(maps); + + alertData.setId(10) + .setContent(mapjson) + .setLog("10") + .setTitle("test"); + AlertInfo alertInfo = new AlertInfo(); + alertInfo.setAlertData(alertData); + Map paramsMap = PluginParamsTransfer.getPluginParamsMap(getEmailAlertParams()); + + alertInfo.setAlertParams(paramsMap); + AlertResult alertResult = emailAlertChannel.process(alertInfo); + Assert.assertNotNull(alertResult); + Assert.assertEquals("false", alertResult.getStatus()); + } + + public String getEmailAlertParams() { + List paramsList = new ArrayList<>(); + InputParam receivesParam = InputParam.newBuilder(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "receivers") + .setValue("540957506@qq.com") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + InputParam mailSmtpHost = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_HOST, "smtp.host") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("smtp.126.com") + .build(); + + InputParam mailSmtpPort = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_PORT, "smtp.port") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .setValue("25") + .build(); + + InputParam mailSender = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SENDER, "sender") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("dolphinscheduler@126.com") + .build(); + + RadioParam enableSmtpAuth = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "smtp.auth") + .addParamsOptions(new ParamsOptions("YES", "true", false)) + .addParamsOptions(new ParamsOptions("NO", "false", false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("false") + .build(); + + InputParam mailUser = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_USER, "user") + .setPlaceholder("if enable use authentication, you need input user") + .setValue("dolphinscheduler@126.com") + .build(); + + PasswordParam mailPassword = PasswordParam.newBuilder(MailParamsConstants.NAME_MAIL_PASSWD, "passwd") + .setPlaceholder("if enable use authentication, you need input password") + .setValue("escheduler123") + .build(); + + RadioParam enableTls = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "starttls.enable") + .addParamsOptions(new ParamsOptions("YES", "true", false)) + .addParamsOptions(new ParamsOptions("NO", "false", false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("true") + .build(); + + RadioParam enableSsl = RadioParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "smtp.ssl.enable") + .addParamsOptions(new ParamsOptions("YES", "true", false)) + .addParamsOptions(new ParamsOptions("NO", "false", false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("true") + .build(); + + InputParam sslTrust = InputParam.newBuilder(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "smtp.ssl.trust") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("smtp.126.com") + .build(); + + List emailShowTypeList = new ArrayList<>(); + emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)); + emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)); + emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)); + emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)); + RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, "showType") + .setOptions(emailShowTypeList) + .setValue(ShowType.TABLE.getDescp()) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + paramsList.add(receivesParam); + paramsList.add(mailSmtpHost); + paramsList.add(mailSmtpPort); + paramsList.add(mailSender); + paramsList.add(enableSmtpAuth); + paramsList.add(mailUser); + paramsList.add(mailPassword); + paramsList.add(enableTls); + paramsList.add(enableSsl); + paramsList.add(sslTrust); + paramsList.add(showType); + + return JSONUtils.toJsonString(paramsList); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java similarity index 100% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java similarity index 80% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java index 5b0b084d72..540bcdee57 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java @@ -17,34 +17,24 @@ package org.apache.dolphinscheduler.plugin.alert.email; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate; import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - */ +import java.util.*; + public class MailUtilsTest { private static final Logger logger = LoggerFactory.getLogger(MailUtilsTest.class); - + static MailSender mailSender; private static Map emailConfig = new HashMap<>(); - private static AlertTemplate alertTemplate; - static MailSender mailSender; - @BeforeClass public static void initEmailConfig() { emailConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp"); @@ -59,7 +49,7 @@ public class MailUtilsTest { emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false"); emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "347801120@qq.com"); emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "347801120@qq.com"); - emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TEXT.getDescp()); + emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp()); alertTemplate = new DefaultHTMLTemplate(); mailSender = new MailSender(emailConfig); } @@ -68,19 +58,19 @@ public class MailUtilsTest { public void testSendMails() { String content = "[\"id:69\"," - + "\"name:UserBehavior-0--1193959466\"," - + "\"Job name: Start workflow\"," - + "\"State: SUCCESS\"," - + "\"Recovery:NO\"," - + "\"Run time: 1\"," - + "\"Start time: 2018-08-06 10:31:34.0\"," - + "\"End time: 2018-08-06 10:31:49.0\"," - + "\"Host: 192.168.xx.xx\"," - + "\"Notify group :4\"]"; + + "\"name:UserBehavior-0--1193959466\"," + + "\"Job name: Start workflow\"," + + "\"State: SUCCESS\"," + + "\"Recovery:NO\"," + + "\"Run time: 1\"," + + "\"Start time: 2018-08-06 10:31:34.0\"," + + "\"End time: 2018-08-06 10:31:49.0\"," + + "\"Host: 192.168.xx.xx\"," + + "\"Notify group :4\"]"; mailSender.sendMails( - "Mysql Exception", - content); + "Mysql Exception", + content); } public String list2String() { @@ -113,7 +103,7 @@ public class MailUtilsTest { public void testSendTableMail() { String title = "Mysql Exception"; String content = list2String(); - emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TABLE.getDescp()); + emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLE.getDescp()); mailSender = new MailSender(emailConfig); mailSender.sendMails(title, content); } @@ -121,7 +111,7 @@ public class MailUtilsTest { @Test public void testAttachmentFile() throws Exception { String content = list2String(); - emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.ATTACHMENT.getDescp()); + emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.ATTACHMENT.getDescp()); mailSender = new MailSender(emailConfig); mailSender.sendMails("gaojing", content); } @@ -129,7 +119,7 @@ public class MailUtilsTest { @Test public void testTableAttachmentFile() throws Exception { String content = list2String(); - emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TABLEATTACHMENT.getDescp()); + emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLEATTACHMENT.getDescp()); mailSender = new MailSender(emailConfig); mailSender.sendMails("gaojing", content); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java similarity index 71% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java index 3d941962d9..d53c95bfbd 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/template/DefaultHTMLTemplateTest.java @@ -19,8 +19,8 @@ package org.apache.dolphinscheduler.plugin.alert.email.template; import static org.junit.Assert.assertEquals; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.plugin.alert.email.EmailConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.ArrayList; @@ -31,19 +31,12 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * test class for DefaultHTMLTemplate - */ public class DefaultHTMLTemplateTest { private static final Logger logger = LoggerFactory.getLogger(DefaultHTMLTemplateTest.class); - /** - * only need test method GetMessageFromTemplate - */ @Test public void testGetMessageFromTemplate() { - DefaultHTMLTemplate template = new DefaultHTMLTemplate(); String tableTypeMessage = template.getMessageFromTemplate(list2String(), ShowType.TABLE, true); @@ -55,11 +48,7 @@ public class DefaultHTMLTemplateTest { assertEquals(textTypeMessage, generateMockTextTypeResultByHand()); } - /** - * generate some simulation data - */ private String list2String() { - LinkedHashMap map1 = new LinkedHashMap<>(); map1.put("mysql service name", "mysql200"); map1.put("mysql address", "192.168.xx.xx"); @@ -84,22 +73,20 @@ public class DefaultHTMLTemplateTest { } private String generateMockTableTypeResultByHand() { - return EmailConstants.HTML_HEADER_PREFIX - + "" - + "mysql service namemysql addressdatabase client connectionsportno index of number" - + "\n" - + "mysql200192.168.xx.xx190330680" - + "mysql210192.168.xx.xx90330610" - + EmailConstants.TABLE_BODY_HTML_TAIL; + + "" + + "mysql service namemysql addressdatabase client connectionsportno index of number" + + "\n" + + "mysql200192.168.xx.xx190330680" + + "mysql210192.168.xx.xx90330610" + + EmailConstants.TABLE_BODY_HTML_TAIL; } private String generateMockTextTypeResultByHand() { - return EmailConstants.HTML_HEADER_PREFIX - + "{\"mysql service name\":\"mysql200\",\"mysql address\":\"192.168.xx.xx\",\"database client connections\":\"190\",\"port\":\"3306\",\"no index of number\":\"80\"}" - + "{\"mysql service name\":\"mysql210\",\"mysql address\":\"192.168.xx.xx\",\"database client connections\":\"90\",\"port\":\"3306\",\"no index of number\":\"10\"}" - + EmailConstants.TABLE_BODY_HTML_TAIL; + + "{\"mysql service name\":\"mysql200\",\"mysql address\":\"192.168.xx.xx\",\"database client connections\":\"190\",\"port\":\"3306\",\"no index of number\":\"80\"}" + + "{\"mysql service name\":\"mysql210\",\"mysql address\":\"192.168.xx.xx\",\"database client connections\":\"90\",\"port\":\"3306\",\"no index of number\":\"10\"}" + + EmailConstants.TABLE_BODY_HTML_TAIL; } } diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/pom.xml new file mode 100644 index 0000000000..aaaea2fe31 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/pom.xml @@ -0,0 +1,40 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-feishu + jar + + + + org.apache.httpcomponents + httpclient + + + com.google.guava + guava + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java similarity index 81% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java index 3bbdaa9997..509eebe615 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannel.java @@ -17,17 +17,16 @@ package org.apache.dolphinscheduler.plugin.alert.feishu; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -public class FeiShuAlertChannel implements AlertChannel { +public final class FeiShuAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo alertInfo) { - AlertData alertData = alertInfo.getAlertData(); Map paramsMap = alertInfo.getAlertParams(); if (null == paramsMap) { diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java similarity index 52% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java index 6eb3376a4d..da78b9f39b 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java @@ -22,59 +22,62 @@ import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_NO; import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; -public class FeiShuAlertChannelFactory implements AlertChannelFactory { +import com.google.auto.service.AutoService; + +@AutoService(AlertChannelFactory.class) +public final class FeiShuAlertChannelFactory implements AlertChannelFactory { @Override - public String getName() { + public String name() { return "Feishu"; } @Override - public List getParams() { + public List params() { InputParam webHookParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_WEB_HOOK, FeiShuParamsConstants.WEB_HOOK) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); RadioParam isEnableProxy = - RadioParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE, FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE) - .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) - .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) - .setValue(STRING_TRUE) - .addValidate(Validate.newBuilder() - .setRequired(false) - .build()) - .build(); + RadioParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY_ENABLE, FeiShuParamsConstants.FEI_SHU_PROXY_ENABLE) + .addParamsOptions(new ParamsOptions(STRING_YES, STRING_TRUE, false)) + .addParamsOptions(new ParamsOptions(STRING_NO, STRING_FALSE, false)) + .setValue(STRING_TRUE) + .addValidate(Validate.newBuilder() + .setRequired(false) + .build()) + .build(); InputParam proxyParam = - InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY, FeiShuParamsConstants.FEI_SHU_PROXY) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PROXY, FeiShuParamsConstants.FEI_SHU_PROXY) + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); InputParam portParam = InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PORT, FeiShuParamsConstants.FEI_SHU_PORT) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); InputParam userParam = - InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_USER, FeiShuParamsConstants.FEI_SHU_USER) - .addValidate(Validate.newBuilder() - .setRequired(false).build()) - .build(); + InputParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_USER, FeiShuParamsConstants.FEI_SHU_USER) + .addValidate(Validate.newBuilder() + .setRequired(false).build()) + .build(); PasswordParam passwordParam = PasswordParam.newBuilder(FeiShuParamsConstants.NAME_FEI_SHU_PASSWORD, FeiShuParamsConstants.FEI_SHU_PASSWORD) - .setPlaceholder("if enable use authentication, you need input password") - .build(); + .setPlaceholder("if enable use authentication, you need input password") + .build(); return Arrays.asList(webHookParam, isEnableProxy, proxyParam, portParam, userParam, passwordParam); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java similarity index 52% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java index 0b3c329792..aa743903e9 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuParamsConstants.java @@ -17,33 +17,29 @@ package org.apache.dolphinscheduler.plugin.alert.feishu; -public class FeiShuParamsConstants { +public final class FeiShuParamsConstants { + public static final String FEI_SHU_PROXY_ENABLE = "$t('isEnableProxy')"; + static final String WEB_HOOK = "$t('webhook')"; + static final String NAME_WEB_HOOK = "WebHook"; + static final String NAME_FEI_SHU_PROXY_ENABLE = "IsEnableProxy"; - private FeiShuParamsConstants() { - throw new IllegalStateException("Utility class"); - } - - static final String WEB_HOOK = "webhook"; - - static final String NAME_WEB_HOOK = "webHook"; + static final String FEI_SHU_PROXY = "$t('proxy')"; - public static final String FEI_SHU_PROXY_ENABLE = "isEnableProxy"; + static final String NAME_FEI_SHU_PROXY = "Proxy"; - static final String NAME_FEI_SHU_PROXY_ENABLE = "isEnableProxy"; + static final String FEI_SHU_PORT = "$t('port')"; - static final String FEI_SHU_PROXY = "proxy"; + static final String NAME_FEI_SHU_PORT = "Port"; - static final String NAME_FEI_SHU_PROXY = "proxy"; + static final String FEI_SHU_USER = "$t('user')"; - static final String FEI_SHU_PORT = "port"; + static final String NAME_FEI_SHU_USER = "User"; - static final String NAME_FEI_SHU_PORT = "port"; + static final String FEI_SHU_PASSWORD = "$t('password')"; - static final String FEI_SHU_USER = "user"; + static final String NAME_FEI_SHU_PASSWORD = "Password"; - static final String NAME_FEI_SHU_USER = "user"; - - static final String FEI_SHU_PASSWORD = "password"; - - static final String NAME_FEI_SHU_PASSWORD = "password"; + private FeiShuParamsConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java similarity index 66% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java index 8fdafe7182..dd40c755ba 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSender.java @@ -17,8 +17,8 @@ package org.apache.dolphinscheduler.plugin.alert.feishu; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.codec.binary.StringUtils; @@ -31,23 +31,18 @@ import org.apache.http.util.EntityUtils; import java.io.IOException; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonProperty; -public class FeiShuSender { - - private static final Logger logger = LoggerFactory.getLogger(FeiShuSender.class); - - private String url; - - private Boolean enableProxy; +public final class FeiShuSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(FeiShuSender.class); + private final String url; + private final Boolean enableProxy; private String proxy; @@ -70,7 +65,6 @@ public class FeiShuSender { } private static String textToJsonString(AlertData alertData) { - Map items = new HashMap<>(2); items.put("msg_type", "text"); Map textContent = new HashMap<>(); @@ -87,14 +81,14 @@ public class FeiShuSender { if (org.apache.dolphinscheduler.spi.utils.StringUtils.isBlank(result)) { alertResult.setMessage("send fei shu msg error"); - logger.info("send fei shu msg error,fei shu server resp is null"); + log.info("send fei shu msg error,fei shu server resp is null"); return alertResult; } FeiShuSendMsgResponse sendMsgResponse = JSONUtils.parseObject(result, FeiShuSendMsgResponse.class); if (null == sendMsgResponse) { alertResult.setMessage("send fei shu msg fail"); - logger.info("send fei shu msg error,resp error"); + log.info("send fei shu msg error,resp error"); return alertResult; } if (sendMsgResponse.statusCode == 0) { @@ -103,7 +97,7 @@ public class FeiShuSender { return alertResult; } alertResult.setMessage(String.format("alert send fei shu msg error : %s", sendMsgResponse.getStatusMessage())); - logger.info("alert send fei shu msg error : {} ,Extra : {} ", sendMsgResponse.getStatusMessage(), sendMsgResponse.getExtra()); + log.info("alert send fei shu msg error : {} ,Extra : {} ", sendMsgResponse.getStatusMessage(), sendMsgResponse.getExtra()); return alertResult; } @@ -118,9 +112,7 @@ public class FeiShuSender { StringBuilder contents = new StringBuilder(100); contents.append(String.format("`%s`%n", alertData.getTitle())); for (Map map : list) { - Iterator> entries = map.entrySet().iterator(); - while (entries.hasNext()) { - Entry entry = entries.next(); + for (Entry entry : (Iterable>) map.entrySet()) { String key = entry.getKey(); String value = entry.getValue().toString(); contents.append(key + ":" + value); @@ -138,7 +130,7 @@ public class FeiShuSender { String resp = sendMsg(alertData); return checkSendFeiShuSendMsgResult(resp); } catch (Exception e) { - logger.info("send fei shu alert msg exception : {}", e.getMessage()); + log.info("send fei shu alert msg exception : {}", e.getMessage()); alertResult = new AlertResult(); alertResult.setStatus("false"); alertResult.setMessage("send fei shu alert fail."); @@ -161,7 +153,7 @@ public class FeiShuSender { int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { - logger.error("send feishu message error, return http status code: {} ", statusCode); + log.error("send feishu message error, return http status code: {} ", statusCode); } String resp; try { @@ -171,14 +163,14 @@ public class FeiShuSender { } finally { response.close(); } - logger.info("Fei Shu send title :{} ,content :{}, resp: {}", alertData.getTitle(), alertData.getContent(), resp); + log.info("Fei Shu send title :{} ,content :{}, resp: {}", alertData.getTitle(), alertData.getContent(), resp); return resp; } finally { httpClient.close(); } } - public static class FeiShuSendMsgResponse { + static final class FeiShuSendMsgResponse { @JsonProperty("Extra") private String extra; @JsonProperty("StatusCode") @@ -186,29 +178,76 @@ public class FeiShuSender { @JsonProperty("StatusMessage") private String statusMessage; + public FeiShuSendMsgResponse() { + } + public String getExtra() { - return extra; + return this.extra; } + @JsonProperty("Extra") public void setExtra(String extra) { this.extra = extra; } public Integer getStatusCode() { - return statusCode; + return this.statusCode; } + @JsonProperty("StatusCode") public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } public String getStatusMessage() { - return statusMessage; + return this.statusMessage; } + @JsonProperty("StatusMessage") public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } - } + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof FeiShuSendMsgResponse)) { + return false; + } + final FeiShuSendMsgResponse other = (FeiShuSendMsgResponse) o; + final Object this$extra = this.getExtra(); + final Object other$extra = other.getExtra(); + if (this$extra == null ? other$extra != null : !this$extra.equals(other$extra)) { + return false; + } + final Object this$statusCode = this.getStatusCode(); + final Object other$statusCode = other.getStatusCode(); + if (this$statusCode == null ? other$statusCode != null : !this$statusCode.equals(other$statusCode)) { + return false; + } + final Object this$statusMessage = this.getStatusMessage(); + final Object other$statusMessage = other.getStatusMessage(); + if (this$statusMessage == null ? other$statusMessage != null : !this$statusMessage.equals(other$statusMessage)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $extra = this.getExtra(); + result = result * PRIME + ($extra == null ? 43 : $extra.hashCode()); + final Object $statusCode = this.getStatusCode(); + result = result * PRIME + ($statusCode == null ? 43 : $statusCode.hashCode()); + final Object $statusMessage = this.getStatusMessage(); + result = result * PRIME + ($statusMessage == null ? 43 : $statusMessage.hashCode()); + return result; + } + + public String toString() { + return "FeiShuSender.FeiShuSendMsgResponse(extra=" + this.getExtra() + ", statusCode=" + this.getStatusCode() + ", statusMessage=" + this.getStatusMessage() + ")"; + } + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java similarity index 92% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java index 3d143579d4..eca9b07d15 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/HttpRequestUtil.java @@ -28,7 +28,10 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -public class HttpRequestUtil { +public final class HttpRequestUtil { + private HttpRequestUtil() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } public static CloseableHttpClient getHttpClient(boolean enableProxy, String proxy, Integer port, String user, String password) { if (enableProxy) { diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java similarity index 92% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java index d73355dbc0..ce51e00474 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.feishu; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.utils.JSONUtils; @@ -31,7 +31,7 @@ public class FeiShuAlertChannelFactoryTest { @Test public void testGetParams() { FeiShuAlertChannelFactory feiShuAlertChannelFactory = new FeiShuAlertChannelFactory(); - List params = feiShuAlertChannelFactory.getParams(); + List params = feiShuAlertChannelFactory.params(); JSONUtils.toJsonString(params); Assert.assertEquals(6, params.size()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java similarity index 74% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java index 05110d42fe..8d5dfdbc6a 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-feishu/src/test/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuSenderTest.java @@ -17,8 +17,8 @@ package org.apache.dolphinscheduler.plugin.alert.feishu; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.HashMap; import java.util.Map; @@ -50,23 +50,23 @@ public class FeiShuSenderTest { @Test public void testFormatContent() { String alertMsg = "[\n" - + " {\n" - + " \"owner\": \"dolphinscheduler\",\n" - + " \"processEndTime\": \"2021-01-29 19:01:11\",\n" - + " \"processHost\": \"10.81.129.4:5678\",\n" - + " \"processId\": 2926,\n" - + " \"processName\": \"3-20210129190038108\",\n" - + " \"processStartTime\": \"2021-01-29 19:00:38\",\n" - + " \"processState\": \"SUCCESS\",\n" - + " \"processType\": \"START_PROCESS\",\n" - + " \"projectId\": 2,\n" - + " \"projectName\": \"testdelproject\",\n" - + " \"recovery\": \"NO\",\n" - + " \"retryTimes\": 0,\n" - + " \"runTimes\": 1,\n" - + " \"taskId\": 0\n" - + " }\n" - + "]"; + + " {\n" + + " \"owner\": \"dolphinscheduler\",\n" + + " \"processEndTime\": \"2021-01-29 19:01:11\",\n" + + " \"processHost\": \"10.81.129.4:5678\",\n" + + " \"processId\": 2926,\n" + + " \"processName\": \"3-20210129190038108\",\n" + + " \"processStartTime\": \"2021-01-29 19:00:38\",\n" + + " \"processState\": \"SUCCESS\",\n" + + " \"processType\": \"START_PROCESS\",\n" + + " \"projectId\": 2,\n" + + " \"projectName\": \"testdelproject\",\n" + + " \"recovery\": \"NO\",\n" + + " \"retryTimes\": 0,\n" + + " \"runTimes\": 1,\n" + + " \"taskId\": 0\n" + + " }\n" + + "]"; AlertData alertData = new AlertData(); alertData.setTitle(""); alertData.setContent(alertMsg); @@ -90,7 +90,7 @@ public class FeiShuSenderTest { AlertResult alertResult = feiShuSender.checkSendFeiShuSendMsgResult(""); Assert.assertFalse(Boolean.valueOf(alertResult.getStatus())); AlertResult alertResult2 = feiShuSender.checkSendFeiShuSendMsgResult("123"); - Assert.assertEquals("send fei shu msg fail",alertResult2.getMessage()); + Assert.assertEquals("send fei shu msg fail", alertResult2.getMessage()); String response = "{\"StatusCode\":\"0\",\"extra\":\"extra\",\"StatusMessage\":\"StatusMessage\"}"; AlertResult alertResult3 = feiShuSender.checkSendFeiShuSendMsgResult(response); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/pom.xml new file mode 100644 index 0000000000..c2e019dc4a --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/pom.xml @@ -0,0 +1,47 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-http + jar + + + + com.google.guava + guava + + + + org.apache.httpcomponents + httpclient + + + + com.fasterxml.jackson.core + jackson-databind + provided + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java similarity index 78% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java index cb550b7541..14b416785d 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannel.java @@ -17,20 +17,16 @@ package org.apache.dolphinscheduler.plugin.alert.http; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -/** - * http alert channel,use sms message to seed the alertInfo - */ -public class HttpAlertChannel implements AlertChannel { +public final class HttpAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo alertInfo) { - AlertData alertData = alertInfo.getAlertData(); Map paramsMap = alertInfo.getAlertParams(); if (null == paramsMap) { diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java new file mode 100644 index 0000000000..d5c628c90c --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java @@ -0,0 +1,78 @@ +/* + * 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.dolphinscheduler.plugin.alert.http; + +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; + +import java.util.Arrays; +import java.util.List; + +import com.google.auto.service.AutoService; + +@AutoService(AlertChannelFactory.class) +public final class HttpAlertChannelFactory implements AlertChannelFactory { + @Override + public String name() { + return "Http"; + } + + @Override + public List params() { + + InputParam url = InputParam.newBuilder(HttpAlertConstants.NAME_URL, HttpAlertConstants.URL) + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam headerParams = InputParam.newBuilder(HttpAlertConstants.NAME_HEADER_PARAMS, HttpAlertConstants.HEADER_PARAMS) + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam bodyParams = InputParam.newBuilder(HttpAlertConstants.NAME_BODY_PARAMS, HttpAlertConstants.BODY_PARAMS) + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam contentField = InputParam.newBuilder(HttpAlertConstants.NAME_CONTENT_FIELD, HttpAlertConstants.CONTENT_FIELD) + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam requestType = InputParam.newBuilder(HttpAlertConstants.NAME_REQUEST_TYPE, HttpAlertConstants.REQUEST_TYPE) + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + return Arrays.asList(url, requestType, headerParams, bodyParams, contentField); + } + + @Override + public AlertChannel create() { + return new HttpAlertChannel(); + } +} diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java new file mode 100644 index 0000000000..6bbf0bfbe0 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java @@ -0,0 +1,44 @@ +/* + * 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.dolphinscheduler.plugin.alert.http; + +public final class HttpAlertConstants { + public static final String URL = "$t('url')"; + + public static final String NAME_URL = "url"; + + public static final String HEADER_PARAMS = "$t('headerParams')"; + + public static final String NAME_HEADER_PARAMS = "headerParams"; + + public static final String BODY_PARAMS = "$t('bodyParams')"; + + public static final String NAME_BODY_PARAMS = "bodyParams"; + + public static final String CONTENT_FIELD = "$t('contentField')"; + + public static final String NAME_CONTENT_FIELD = "contentField"; + + public static final String REQUEST_TYPE = "$t('requestType')"; + + public static final String NAME_REQUEST_TYPE = "requestType"; + + private HttpAlertConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java similarity index 84% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java index 7b9190494b..bc789edc5f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSender.java @@ -17,10 +17,10 @@ package org.apache.dolphinscheduler.plugin.alert.http; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; - import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -30,56 +30,37 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; import java.util.HashMap; import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -/** - * http send message - */ -public class HttpSender { - - public static final Logger logger = LoggerFactory.getLogger(HttpSender.class); - - private String url; - - private final String headerParams; - - private final String bodyParams; - - private final String contentField; - - private final String requestType; - - private HttpRequestBase httpRequest; - - +public final class HttpSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(HttpSender.class); private static final String URL_SPLICE_CHAR = "?"; - /** * request type post */ private static final String REQUEST_TYPE_POST = "POST"; - /** * request type get */ private static final String REQUEST_TYPE_GET = "GET"; - private static final String DEFAULT_CHARSET = "utf-8"; + private final String headerParams; + private final String bodyParams; + private final String contentField; + private final String requestType; + private String url; + private HttpRequestBase httpRequest; public HttpSender(Map paramsMap) { - url = paramsMap.get(HttpAlertConstants.URL); - headerParams = paramsMap.get(HttpAlertConstants.HEADER_PARAMS); - bodyParams = paramsMap.get(HttpAlertConstants.BODY_PARAMS); - contentField = paramsMap.get(HttpAlertConstants.CONTENT_FIELD); - requestType = paramsMap.get(HttpAlertConstants.REQUEST_TYPE); + url = paramsMap.get(HttpAlertConstants.NAME_URL); + headerParams = paramsMap.get(HttpAlertConstants.NAME_HEADER_PARAMS); + bodyParams = paramsMap.get(HttpAlertConstants.NAME_BODY_PARAMS); + contentField = paramsMap.get(HttpAlertConstants.NAME_CONTENT_FIELD); + requestType = paramsMap.get(HttpAlertConstants.NAME_REQUEST_TYPE); } public AlertResult send(String msg) { @@ -102,7 +83,7 @@ public class HttpSender { alertResult.setStatus("true"); alertResult.setMessage(resp); } catch (Exception e) { - logger.error("send http alert msg exception : {}", e.getMessage()); + log.error("send http alert msg exception : {}", e.getMessage()); alertResult.setStatus("false"); alertResult.setMessage("send http request alert fail."); } @@ -157,16 +138,15 @@ public class HttpSender { /** * set body params */ - private void setMsgInRequestBody(String msg) { + private void setMsgInRequestBody(String msg) { ObjectNode objectNode = JSONUtils.parseObject(bodyParams); //set msg content field objectNode.put(contentField, msg); try { StringEntity entity = new StringEntity(bodyParams, DEFAULT_CHARSET); - ((HttpPost)httpRequest).setEntity(entity); + ((HttpPost) httpRequest).setEntity(entity); } catch (Exception e) { - logger.error("send http alert msg exception : {}", e.getMessage()); + log.error("send http alert msg exception : {}", e.getMessage()); } } - } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java similarity index 93% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java index 25181ebd26..089f78f3af 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.http; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import java.util.List; @@ -26,9 +26,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -/** - * HttpAlertChannelFactory UT - */ public class HttpAlertChannelFactoryTest { private HttpAlertChannelFactory httpAlertChannelFactory; @@ -41,7 +38,7 @@ public class HttpAlertChannelFactoryTest { @Test public void getParamsTest() { - List pluginParamsList = httpAlertChannelFactory.getParams(); + List pluginParamsList = httpAlertChannelFactory.params(); Assert.assertEquals(5, pluginParamsList.size()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java similarity index 70% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java index 2d29407e71..ca63902aae 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java @@ -17,13 +17,13 @@ package org.apache.dolphinscheduler.plugin.alert.http; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.ArrayList; @@ -33,9 +33,6 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; -/** - * HttpAlertChannel UT - */ public class HttpAlertChannelTest { @Test @@ -71,29 +68,29 @@ public class HttpAlertChannelTest { List paramsList = new ArrayList<>(); InputParam urlParam = InputParam.newBuilder("url", "url") - .setValue("http://www.baidu.com") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + .setValue("http://www.baidu.com") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); InputParam headerParams = InputParam.newBuilder("headerParams", "headerParams") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("{\"Content-Type\":\"application/json\"}") - .build(); + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("{\"Content-Type\":\"application/json\"}") + .build(); InputParam bodyParams = InputParam.newBuilder("bodyParams", "bodyParams") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("{\"number\":\"13457654323\"}") - .build(); + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("{\"number\":\"13457654323\"}") + .build(); InputParam content = InputParam.newBuilder("contentField", "contentField") - .setValue("content") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + .setValue("content") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); InputParam requestType = InputParam.newBuilder("requestType", "requestType") - .setValue("POST") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + .setValue("POST") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); paramsList.add(urlParam); paramsList.add(headerParams); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java similarity index 73% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java index d59c4d47bb..637c615dd1 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpSenderTest.java @@ -17,28 +17,23 @@ package org.apache.dolphinscheduler.plugin.alert.http; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertResult; +import org.junit.Assert; +import org.junit.Test; import java.util.HashMap; import java.util.Map; -import org.junit.Assert; -import org.junit.Test; - -/** - * HttpSender UT - */ public class HttpSenderTest { @Test public void sendTest() { - Map paramsMap = new HashMap<>(); - paramsMap.put(HttpAlertConstants.URL, "http://www.baidu.com"); - paramsMap.put(HttpAlertConstants.REQUEST_TYPE, "POST"); - paramsMap.put(HttpAlertConstants.HEADER_PARAMS, "{\"Content-Type\":\"application/json\"}"); - paramsMap.put(HttpAlertConstants.BODY_PARAMS, "{\"number\":\"13457654323\"}"); - paramsMap.put(HttpAlertConstants.CONTENT_FIELD, "content"); + paramsMap.put(HttpAlertConstants.NAME_URL, "http://www.baidu.com"); + paramsMap.put(HttpAlertConstants.NAME_REQUEST_TYPE, "POST"); + paramsMap.put(HttpAlertConstants.NAME_HEADER_PARAMS, "{\"Content-Type\":\"application/json\"}"); + paramsMap.put(HttpAlertConstants.NAME_BODY_PARAMS, "{\"number\":\"13457654323\"}"); + paramsMap.put(HttpAlertConstants.NAME_CONTENT_FIELD, "content"); HttpSender httpSender = new HttpSender(paramsMap); AlertResult alertResult = httpSender.send("Fault tolerance warning"); Assert.assertEquals("true", alertResult.getStatus()); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml new file mode 100644 index 0000000000..7f8443e609 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/pom.xml @@ -0,0 +1,36 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-script + jar + + + + com.google.guava + guava + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java similarity index 88% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java index b8816724c7..51e567b47e 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/OSUtils.java @@ -17,13 +17,9 @@ package org.apache.dolphinscheduler.plugin.alert.script; -/** - * OSUtils - */ -public class OSUtils { - +public final class OSUtils { private OSUtils() { - throw new UnsupportedOperationException("Construct OSUtils"); + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } static Boolean isWindows() { diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java similarity index 84% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java index d63a350051..7008267877 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtils.java @@ -20,17 +20,12 @@ package org.apache.dolphinscheduler.plugin.alert.script; import java.io.IOException; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * ProcessUtils - */ -public class ProcessUtils { - - private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class); +public final class ProcessUtils { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(ProcessUtils.class); private ProcessUtils() { - throw new IllegalStateException("Utility class"); + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } /** @@ -53,7 +48,7 @@ public class ProcessUtils { errorStreamGobbler.start(); return process.waitFor(); } catch (IOException | InterruptedException e) { - logger.error("execute alert script error {}", e.getMessage()); + log.error("execute alert script error {}", e.getMessage()); Thread.currentThread().interrupt(); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java similarity index 77% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java index af0c27615f..bd52955b74 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannel.java @@ -17,18 +17,14 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -/** - * ScriptAlertChannel - */ -public class ScriptAlertChannel implements AlertChannel { - +public final class ScriptAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo alertinfo) { AlertData alertData = alertinfo.getAlertData(); @@ -36,6 +32,6 @@ public class ScriptAlertChannel implements AlertChannel { if (null == paramsMap) { return new AlertResult("false", "script params is null"); } - return new ScriptSender(paramsMap).sendScriptAlert(alertData.getTitle(),alertData.getContent()); + return new ScriptSender(paramsMap).sendScriptAlert(alertData.getTitle(), alertData.getContent()); } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java similarity index 52% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java index 67cfc3931f..aacde95ba1 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java @@ -17,49 +17,49 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.params.input.InputParam; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; -/** - * ScriptAlertChannelFactory - */ -public class ScriptAlertChannelFactory implements AlertChannelFactory { +import com.google.auto.service.AutoService; +@AutoService(AlertChannelFactory.class) +public final class ScriptAlertChannelFactory implements AlertChannelFactory { @Override - public String getName() { + public String name() { return "Script"; } @Override - public List getParams() { + public List params() { InputParam scriptUserParam = InputParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_USER_PARAMS, ScriptParamsConstants.SCRIPT_USER_PARAMS) - .addValidate(Validate.newBuilder() - .setRequired(false) - .build()) - .setPlaceholder("please enter your custom parameters, which will be passed to you when calling your script") - .build(); + .addValidate(Validate.newBuilder() + .setRequired(false) + .build()) + .setPlaceholder("please enter your custom parameters, which will be passed to you when calling your script") + .build(); // need check file type and file exist InputParam scriptPathParam = InputParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_PATH, ScriptParamsConstants.SCRIPT_PATH) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .setPlaceholder("please upload the file to the disk directory of the alert server, and ensure that the path is absolute and has the corresponding access rights") - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .setPlaceholder("please upload the file to the disk directory of the alert server," + + " and ensure that the path is absolute and has the corresponding access rights") + .build(); RadioParam scriptTypeParams = RadioParam.newBuilder(ScriptParamsConstants.NAME_SCRIPT_TYPE, ScriptParamsConstants.SCRIPT_TYPE) - .addParamsOptions(new ParamsOptions(ScriptType.SHELL.getDescp(), ScriptType.SHELL.getDescp(), false)) - .setValue(ScriptType.SHELL.getDescp()) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + .addParamsOptions(new ParamsOptions(ScriptType.SHELL.getDescp(), ScriptType.SHELL.getDescp(), false)) + .setValue(ScriptType.SHELL.getDescp()) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); return Arrays.asList(scriptUserParam, scriptPathParam, scriptTypeParams); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java similarity index 76% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java index 5b096d54ad..e680903fb2 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptParamsConstants.java @@ -17,24 +17,20 @@ package org.apache.dolphinscheduler.plugin.alert.script; -/** - * ScriptParamsConstants - */ -public class ScriptParamsConstants { - - private ScriptParamsConstants() { - throw new IllegalStateException("Utility class"); - } - - static final String SCRIPT_TYPE = "type"; +public final class ScriptParamsConstants { + static final String SCRIPT_TYPE = "$t('scriptType')"; static final String NAME_SCRIPT_TYPE = "type"; - static final String SCRIPT_PATH = "path"; + static final String SCRIPT_PATH = "$t('scriptPath')"; static final String NAME_SCRIPT_PATH = "path"; - static final String SCRIPT_USER_PARAMS = "user.params"; + static final String SCRIPT_USER_PARAMS = "$t('userParams')"; static final String NAME_SCRIPT_USER_PARAMS = "userParams"; + + private ScriptParamsConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java similarity index 86% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java index 8e33b792d8..a4dbe1eabc 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSender.java @@ -17,31 +17,20 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * ScriptSender - */ -public class ScriptSender { - - private static final Logger logger = LoggerFactory.getLogger(ScriptSender.class); - - private String scriptPath; - - private String scriptType; - - private String userParams; +public final class ScriptSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(ScriptSender.class); private static final String ALERT_TITLE_OPTION = " -t "; - private static final String ALERT_CONTENT_OPTION = " -c "; - private static final String ALERT_USER_PARAMS_OPTION = " -p "; + private final String scriptPath; + private final String scriptType; + private final String userParams; ScriptSender(Map config) { scriptPath = config.get(ScriptParamsConstants.NAME_SCRIPT_PATH); @@ -73,7 +62,7 @@ public class ScriptSender { return alertResult; } alertResult.setMessage("send script alert msg error,exitCode is " + exitCode); - logger.info("send script alert msg error,exitCode is {}", exitCode); + log.info("send script alert msg error,exitCode is {}", exitCode); return alertResult; } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java similarity index 94% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java index ff3b8096bb..cbb3e11f28 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptType.java @@ -17,26 +17,17 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import java.util.HashMap; -import java.util.Map; - -/** - * ScriptType - */ public enum ScriptType { - - SHELL(0, "SHELL"), ; + private final int code; + private final String descp; ScriptType(int code, String descp) { this.code = code; this.descp = descp; } - private final int code; - private final String descp; - public int getCode() { return code; } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java similarity index 81% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java index 41aabfe13d..6b1d19a072 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/StreamGobbler.java @@ -23,16 +23,11 @@ import java.io.InputStream; import java.io.InputStreamReader; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * StreamGobbler - */ -public class StreamGobbler extends Thread { - - private static final Logger logger = LoggerFactory.getLogger(StreamGobbler.class); +public final class StreamGobbler extends Thread { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(StreamGobbler.class); - private InputStream inputStream; + private final InputStream inputStream; StreamGobbler(InputStream inputStream) { this.inputStream = inputStream; @@ -51,16 +46,16 @@ public class StreamGobbler extends Thread { output.append(System.getProperty("line.separator")); } if (output.length() > 0) { - logger.info("out put msg is{}", output); + log.info("out put msg is{}", output); } } catch (IOException e) { - logger.error("I/O error occurs {}", e.getMessage()); + log.error("I/O error occurs {}", e.getMessage()); } finally { try { inputBufferReader.close(); inputStreamReader.close(); } catch (IOException e) { - logger.error("I/O error occurs {}", e.getMessage()); + log.error("I/O error occurs {}", e.getMessage()); } } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java similarity index 93% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java index 1d847a0635..7ee473e9a7 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ProcessUtilsTest.java @@ -26,7 +26,7 @@ public class ProcessUtilsTest { private static final String rootPath = System.getProperty("user.dir"); - private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh"; + private static final String shellFilPath = rootPath + "/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh"; private String[] cmd = {"/bin/sh", "-c", shellFilPath + " -t 1"}; diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java similarity index 91% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java index 8cedc2c38e..ca45cf7aed 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import java.util.List; @@ -33,7 +33,7 @@ public class ScriptAlertChannelFactoryTest { @Test public void testGetParams() { ScriptAlertChannelFactory scriptAlertChannelFactory = new ScriptAlertChannelFactory(); - List params = scriptAlertChannelFactory.getParams(); + List params = scriptAlertChannelFactory.params(); Assert.assertEquals(3, params.size()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java similarity index 97% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java index e022b9ebf7..445d0738b5 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptSenderTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.script; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.HashMap; import java.util.Map; @@ -31,11 +31,9 @@ import org.junit.Test; */ public class ScriptSenderTest { - private static Map scriptConfig = new HashMap<>(); - private static final String rootPath = System.getProperty("user.dir"); - private static final String shellFilPath = rootPath + "/src/test/script/shell/scriptExample.sh"; + private static Map scriptConfig = new HashMap<>(); @Before public void initScriptConfig() { diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh similarity index 100% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/scriptExample.sh diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh similarity index 100% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/test/script/shell/test.sh rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-script/src/test/script/shell/test.sh diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/pom.xml new file mode 100644 index 0000000000..f24073e718 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/pom.xml @@ -0,0 +1,41 @@ + + + + + dolphinscheduler-alert-plugins + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-alert-slack + jar + + + + org.apache.httpcomponents + httpclient + + + + com.google.guava + guava + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java similarity index 82% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java index 6399d8bca9..b63fed0574 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannel.java @@ -17,18 +17,14 @@ package org.apache.dolphinscheduler.plugin.alert.slack; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -/** - * SlackAlertChannel - */ -public class SlackAlertChannel implements AlertChannel { - +public final class SlackAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo alertInfo) { AlertData alertData = alertInfo.getAlertData(); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java similarity index 61% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java index d56976400a..9819ed4b33 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java @@ -17,42 +17,41 @@ package org.apache.dolphinscheduler.plugin.alert.slack; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import java.util.LinkedList; import java.util.List; -/** - * Slack alert factory, see {@link AlertChannelFactory} - */ -public class SlackAlertChannelFactory implements AlertChannelFactory { +import com.google.auto.service.AutoService; +@AutoService(AlertChannelFactory.class) +public final class SlackAlertChannelFactory implements AlertChannelFactory { @Override - public String getName() { + public String name() { return "Slack"; } @Override - public List getParams() { + public List params() { List paramsList = new LinkedList<>(); InputParam webHookParam = InputParam.newBuilder(SlackParamsConstants.SLACK_WEN_HOOK_URL_NAME, SlackParamsConstants.SLACK_WEB_HOOK_URL) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .setPlaceholder("Input WebHook Url") - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .setPlaceholder("Input WebHook Url") + .build(); InputParam botName = InputParam.newBuilder(SlackParamsConstants.SLACK_BOT_NAME, SlackParamsConstants.SLACK_BOT) - .addValidate(Validate.newBuilder() - .setRequired(true) - .build()) - .setPlaceholder("Input the bot username") - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .setPlaceholder("Input the bot username") + .build(); paramsList.add(webHookParam); paramsList.add(botName); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java similarity index 81% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java index fd191c5d55..928eba6719 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackParamsConstants.java @@ -17,18 +17,17 @@ package org.apache.dolphinscheduler.plugin.alert.slack; -public class SlackParamsConstants { - - private SlackParamsConstants() { - - } - - public static final String SLACK_WEB_HOOK_URL = "WebHook"; +public final class SlackParamsConstants { + public static final String SLACK_WEB_HOOK_URL = "$t('webhook')"; public static final String SLACK_WEN_HOOK_URL_NAME = "webHook"; - public static final String SLACK_BOT = "Username"; + public static final String SLACK_BOT = "$t('Username')"; public static final String SLACK_BOT_NAME = "username"; public static final String TEXT = "text"; public static final String ATTACHMENT = "attachments"; public static final Integer MAX_SHOW_NUMBER = 100; + + private SlackParamsConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java similarity index 88% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java index 21a8286211..579fbaa05c 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSender.java @@ -39,17 +39,14 @@ import java.util.Objects; import java.util.stream.Collectors; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; -public class SlackSender { +public final class SlackSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(SlackSender.class); - private static final Logger logger = LoggerFactory.getLogger(SlackSender.class); - - private String webHookUrl; - - private String botName; + private final String webHookUrl; + private final String botName; public SlackSender(Map slackAlertParam) { webHookUrl = slackAlertParam.get(SlackParamsConstants.SLACK_WEN_HOOK_URL_NAME); @@ -86,7 +83,7 @@ public class SlackSender { HttpEntity entity = response.getEntity(); return EntityUtils.toString(entity, "UTF-8"); } catch (Exception e) { - logger.error("Send message to slack error.", e); + log.error("Send message to slack error.", e); return "System Exception"; } } @@ -122,17 +119,17 @@ public class SlackSender { final int elementLen = maxLen; StringBuilder stringBuilder = new StringBuilder(200); stringBuilder.append(headers.stream() - .map(header -> generateString(header, elementLen, " ")) - .collect(Collectors.joining("|"))); + .map(header -> generateString(header, elementLen, " ")) + .collect(Collectors.joining("|"))); stringBuilder.append("\n"); for (List element : elements) { stringBuilder.append(element.stream() - .map(lement -> generateString("", elementLen, "-")) - .collect(Collectors.joining("|"))); + .map(lement -> generateString("", elementLen, "-")) + .collect(Collectors.joining("|"))); stringBuilder.append("\n"); stringBuilder.append(element.stream() - .map(e -> generateString(e, elementLen, " ")) - .collect(Collectors.joining("|"))); + .map(e -> generateString(e, elementLen, " ")) + .collect(Collectors.joining("|"))); stringBuilder.append("\n"); } return String.format("```%s```", stringBuilder); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java similarity index 87% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java index e294365da7..21ba907ee7 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.slack; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import java.util.List; @@ -31,12 +31,12 @@ public class SlackAlertChannelFactoryTest { @Test public void testTestGetName() { - Assert.assertEquals("Slack", slackAlertChannelFactory.getName()); + Assert.assertEquals("Slack", slackAlertChannelFactory.name()); } @Test public void testGetParams() { - List params = slackAlertChannelFactory.getParams(); + List params = slackAlertChannelFactory.params(); Assert.assertEquals(2, params.size()); } @@ -45,4 +45,4 @@ public class SlackAlertChannelFactoryTest { AlertChannel alertChannel = slackAlertChannelFactory.create(); Assert.assertTrue(alertChannel instanceof SlackAlertChannel); } -} \ No newline at end of file +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java similarity index 95% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java index a488026b42..c675aca0e8 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-slack/src/test/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackSenderTest.java @@ -29,11 +29,11 @@ public class SlackSenderTest { public void testSendMessage() { Map alertparam = new HashMap<>(); alertparam.put(SlackParamsConstants.SLACK_WEN_HOOK_URL_NAME, - "https://hooks.slack.com/services/123456"); + "https://hooks.slack.com/services/123456"); alertparam.put(SlackParamsConstants.SLACK_BOT_NAME, "Dolphinscheduler"); SlackSender slackSender = new SlackSender(alertparam); String response = slackSender.sendMessage("test title", "test content"); Assert.assertNotEquals("ok", response); } -} \ No newline at end of file +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/pom.xml similarity index 55% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/pom.xml index 5e85b32b5b..7258476706 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/pom.xml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/pom.xml @@ -15,25 +15,19 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + - dolphinscheduler-alert-plugin + dolphinscheduler-alert-plugins org.apache.dolphinscheduler 2.0.1-SNAPSHOT 4.0.0 - - org.apache.dolphinscheduler - dolphinscheduler-alert-slack - dolphinscheduler-plugin + dolphinscheduler-alert-wechat + jar - - - org.apache.httpcomponents - httpclient - - com.google.guava guava @@ -45,39 +39,14 @@ - org.slf4j - slf4j-api + org.apache.httpcomponents + httpclient com.fasterxml.jackson.core - jackson-annotations + jackson-databind provided - - - junit - junit - test - - - - org.mockito - mockito-core - jar - test - - - - org.jacoco - org.jacoco.agent - runtime - test - - - - dolphinscheduler-alert-slack-${project.version} - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java similarity index 80% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java index 36cce09ff3..94b43ea300 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannel.java @@ -17,18 +17,14 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import java.util.Map; -/** - * WeChatAlertChannel - */ -public class WeChatAlertChannel implements AlertChannel { - +public final class WeChatAlertChannel implements AlertChannel { @Override public AlertResult process(AlertInfo info) { AlertData alertData = info.getAlertData(); diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java new file mode 100644 index 0000000000..299ffdd310 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.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.dolphinscheduler.plugin.alert.wechat; + +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.ShowType; +import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; + +import java.util.Arrays; +import java.util.List; + +import com.google.auto.service.AutoService; + +@AutoService(AlertChannelFactory.class) +public final class WeChatAlertChannelFactory implements AlertChannelFactory { + @Override + public String name() { + return "WeChat"; + } + + @Override + public List params() { + InputParam corpIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_CORP_ID) + .setPlaceholder("please input corp id ") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam secretParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET) + .setPlaceholder("please input secret ") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam usersParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS) + .setPlaceholder("please input users ") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam userSendMsgParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USER_SEND_MSG) + .setPlaceholder("please input corp id ") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + InputParam agentIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_AGENT_ID) + .setPlaceholder("please input agent id ") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, AlertConstants.SHOW_TYPE) + .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) + .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) + .setValue(ShowType.TABLE.getDescp()) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); + + return Arrays.asList(corpIdParam, secretParam, usersParam, userSendMsgParam, agentIdParam, showType); + } + + @Override + public AlertChannel create() { + return new WeChatAlertChannel(); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java similarity index 89% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java index 9aec21b9d9..141542fa7f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.java @@ -17,15 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -/** - * WeChatAlertConstants - */ -public class WeChatAlertConstants { - - private WeChatAlertConstants() { - throw new IllegalStateException(WeChatAlertConstants.class.getName()); - } - +public final class WeChatAlertConstants { static final String MARKDOWN_QUOTE = ">"; static final String MARKDOWN_ENTER = "\n"; @@ -35,4 +27,8 @@ public class WeChatAlertConstants { static final String WE_CHAT_PUSH_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}"; static final String WE_CHAT_TOKEN_URL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpId}&corpsecret={secret}"; + + private WeChatAlertConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java similarity index 69% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java index c254b27ebf..e4c63813ae 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.java @@ -17,43 +17,21 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -/** - * WeChatAlertParamsConstants - */ -public class WeChatAlertParamsConstants { - - private WeChatAlertParamsConstants() { - throw new IllegalStateException(WeChatAlertParamsConstants.class.getName()); - } - - static final String ENTERPRISE_WE_CHAT_CORP_ID = "corp.id"; - +public final class WeChatAlertParamsConstants { + static final String ENTERPRISE_WE_CHAT_CORP_ID = "$t('corpId')"; static final String NAME_ENTERPRISE_WE_CHAT_CORP_ID = "corpId"; - - - static final String ENTERPRISE_WE_CHAT_SECRET = "secret"; - + static final String ENTERPRISE_WE_CHAT_SECRET = "$t('secret')"; static final String NAME_ENTERPRISE_WE_CHAT_SECRET = "secret"; - - static final String ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "team.send.msg"; - + static final String ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "$t('teamSendMsg')"; static final String NAME_ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "teamSendMsg"; - - - static final String ENTERPRISE_WE_CHAT_USER_SEND_MSG = "user.send.msg"; - + static final String ENTERPRISE_WE_CHAT_USER_SEND_MSG = "$t('userSendMsg')"; static final String NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG = "userSendMsg"; - - - static final String ENTERPRISE_WE_CHAT_AGENT_ID = "agent.id"; - + static final String ENTERPRISE_WE_CHAT_AGENT_ID = "$t('agentId')"; static final String NAME_ENTERPRISE_WE_CHAT_AGENT_ID = "agentId"; - - - static final String ENTERPRISE_WE_CHAT_USERS = "users"; - - + static final String ENTERPRISE_WE_CHAT_USERS = "$t('users')"; static final String NAME_ENTERPRISE_WE_CHAT_USERS = "users"; - + private WeChatAlertParamsConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java similarity index 78% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java index 6944da66bb..1febc8b800 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.java @@ -17,15 +17,11 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -import static java.util.Objects.requireNonNull; - -import org.apache.dolphinscheduler.plugin.alert.wechat.exception.WeChatAlertException; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.apache.dolphinscheduler.spi.alert.ShowType; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.AlertResult; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; - import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -34,41 +30,16 @@ 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 java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * WeChatSender - */ -public class WeChatSender { - - private static Logger logger = LoggerFactory.getLogger(WeChatSender.class); - - private String weChatAgentId; - - private String weChatUsers; - - private String weChatUserSendMsg; - - private String weChatTokenUrlReplace; - - private String weChatToken; - - private String showType; +import static java.util.Objects.requireNonNull; +public final class WeChatSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(WeChatSender.class); private static final String MUST_NOT_NULL = " must not null"; private static final String ALERT_STATUS = "false"; private static final String AGENT_ID_REG_EXP = "{agentId}"; @@ -77,6 +48,12 @@ public class WeChatSender { private static final String CORP_ID_REGEX = "{corpId}"; private static final String SECRET_REGEX = "{secret}"; private static final String TOKEN_REGEX = "{token}"; + private final String weChatAgentId; + private final String weChatUsers; + private final String weChatUserSendMsg; + private final String weChatTokenUrlReplace; + private final String weChatToken; + private final String showType; WeChatSender(Map config) { weChatAgentId = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID); @@ -85,58 +62,14 @@ public class WeChatSender { String weChatSecret = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET); String weChatTokenUrl = WeChatAlertConstants.WE_CHAT_TOKEN_URL; weChatUserSendMsg = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG); - showType = config.get(AlertConstants.SHOW_TYPE); - requireNonNull(showType, AlertConstants.SHOW_TYPE + MUST_NOT_NULL); + showType = config.get(AlertConstants.NAME_SHOW_TYPE); + requireNonNull(showType, AlertConstants.NAME_SHOW_TYPE + MUST_NOT_NULL); weChatTokenUrlReplace = weChatTokenUrl .replace(CORP_ID_REGEX, weChatCorpId) .replace(SECRET_REGEX, weChatSecret); weChatToken = getToken(); } - /** - * make user multi user message - * - * @param toUser the toUser - * @param agentId the agentId - * @param msg the msg - * @return Enterprise WeChat send message - */ - private String makeUserSendMsg(Collection toUser, String agentId, String msg) { - String listUser = mkString(toUser); - return weChatUserSendMsg.replace(USER_REG_EXP, listUser) - .replace(AGENT_ID_REG_EXP, agentId) - .replace(MSG_REG_EXP, msg); - } - - /** - * send Enterprise WeChat - * - * @return Enterprise WeChat resp, demo: {"errcode":0,"errmsg":"ok","invaliduser":""} - */ - public AlertResult sendEnterpriseWeChat(String title, String content) { - AlertResult alertResult; - List userList = Arrays.asList(weChatUsers.split(",")); - String data = markdownByAlert(title, content); - String msg = makeUserSendMsg(userList, weChatAgentId, data); - if (null == weChatToken) { - alertResult = new AlertResult(); - alertResult.setMessage("send we chat alert fail,get weChat token error"); - alertResult.setStatus(ALERT_STATUS); - return alertResult; - } - String enterpriseWeChatPushUrlReplace = WeChatAlertConstants.WE_CHAT_PUSH_URL.replace(TOKEN_REGEX, weChatToken); - - try { - return checkWeChatSendMsgResult(post(enterpriseWeChatPushUrlReplace, msg)); - } catch (Exception e) { - logger.info("send we chat alert msg exception : {}", e.getMessage()); - alertResult = new AlertResult(); - alertResult.setMessage("send we chat alert fail"); - alertResult.setStatus(ALERT_STATUS); - } - return alertResult; - } - private static String post(String url, String data) throws IOException { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpPost httpPost = new HttpPost(url); @@ -150,7 +83,7 @@ public class WeChatSender { } finally { response.close(); } - logger.info("Enterprise WeChat send [{}], param:{}, resp:{}", + log.info("Enterprise WeChat send [{}], param:{}, resp:{}", url, data, resp); return resp; } @@ -166,8 +99,8 @@ public class WeChatSender { private static String markdownTable(String title, String content) { List mapItemsList = JSONUtils.toList(content, LinkedHashMap.class); if (null == mapItemsList || mapItemsList.isEmpty()) { - logger.error("itemsList is null"); - throw new WeChatAlertException("itemsList is null"); + log.error("itemsList is null"); + throw new RuntimeException("itemsList is null"); } StringBuilder contents = new StringBuilder(200); for (LinkedHashMap mapItems : mapItemsList) { @@ -199,7 +132,7 @@ public class WeChatSender { if (StringUtils.isNotEmpty(content)) { List mapItemsList = JSONUtils.toList(content, LinkedHashMap.class); if (null == mapItemsList || mapItemsList.isEmpty()) { - logger.error("itemsList is null"); + log.error("itemsList is null"); throw new RuntimeException("itemsList is null"); } @@ -220,31 +153,6 @@ public class WeChatSender { return null; } - /** - * Determine the mardown style based on the show type of the alert - * - * @return the markdown alert table/text - */ - private String markdownByAlert(String title, String content) { - String result = ""; - if (showType.equals(ShowType.TABLE.getDescp())) { - result = markdownTable(title, content); - } else if (showType.equals(ShowType.TEXT.getDescp())) { - result = markdownText(title, content); - } - return result; - - } - - private String getToken() { - try { - return get(weChatTokenUrlReplace); - } catch (IOException e) { - logger.info("we chat alert get token error{}", e.getMessage()); - } - return null; - } - private static String get(String url) throws IOException { String resp; @@ -266,7 +174,6 @@ public class WeChatSender { } private static String mkString(Iterable list) { - if (null == list || StringUtils.isEmpty("|")) { return null; } @@ -284,40 +191,19 @@ public class WeChatSender { return sb.toString(); } - public static class WeChatSendMsgResponse { - private Integer errcode; - private String errmsg; - - public Integer getErrcode() { - return errcode; - } - - public void setErrcode(Integer errcode) { - this.errcode = errcode; - } - - public String getErrmsg() { - return errmsg; - } - - public void setErrmsg(String errmsg) { - this.errmsg = errmsg; - } - } - private static AlertResult checkWeChatSendMsgResult(String result) { AlertResult alertResult = new AlertResult(); alertResult.setStatus(ALERT_STATUS); if (null == result) { alertResult.setMessage("we chat send fail"); - logger.info("send we chat msg error,resp is null"); + log.info("send we chat msg error,resp is null"); return alertResult; } WeChatSendMsgResponse sendMsgResponse = JSONUtils.parseObject(result, WeChatSendMsgResponse.class); if (null == sendMsgResponse) { alertResult.setMessage("we chat send fail"); - logger.info("send we chat msg error,resp error"); + log.info("send we chat msg error,resp error"); return alertResult; } if (sendMsgResponse.errcode == 0) { @@ -329,4 +215,132 @@ public class WeChatSender { alertResult.setMessage(sendMsgResponse.getErrmsg()); return alertResult; } + + /** + * make user multi user message + * + * @param toUser the toUser + * @param agentId the agentId + * @param msg the msg + * @return Enterprise WeChat send message + */ + private String makeUserSendMsg(Collection toUser, String agentId, String msg) { + String listUser = mkString(toUser); + return weChatUserSendMsg.replace(USER_REG_EXP, listUser) + .replace(AGENT_ID_REG_EXP, agentId) + .replace(MSG_REG_EXP, msg); + } + + /** + * send Enterprise WeChat + * + * @return Enterprise WeChat resp, demo: {"errcode":0,"errmsg":"ok","invaliduser":""} + */ + public AlertResult sendEnterpriseWeChat(String title, String content) { + AlertResult alertResult; + List userList = Arrays.asList(weChatUsers.split(",")); + String data = markdownByAlert(title, content); + String msg = makeUserSendMsg(userList, weChatAgentId, data); + if (null == weChatToken) { + alertResult = new AlertResult(); + alertResult.setMessage("send we chat alert fail,get weChat token error"); + alertResult.setStatus(ALERT_STATUS); + return alertResult; + } + String enterpriseWeChatPushUrlReplace = WeChatAlertConstants.WE_CHAT_PUSH_URL.replace(TOKEN_REGEX, weChatToken); + + try { + return checkWeChatSendMsgResult(post(enterpriseWeChatPushUrlReplace, msg)); + } catch (Exception e) { + log.info("send we chat alert msg exception : {}", e.getMessage()); + alertResult = new AlertResult(); + alertResult.setMessage("send we chat alert fail"); + alertResult.setStatus(ALERT_STATUS); + } + return alertResult; + } + + /** + * Determine the mardown style based on the show type of the alert + * + * @return the markdown alert table/text + */ + private String markdownByAlert(String title, String content) { + String result = ""; + if (showType.equals(ShowType.TABLE.getDescp())) { + result = markdownTable(title, content); + } else if (showType.equals(ShowType.TEXT.getDescp())) { + result = markdownText(title, content); + } + return result; + + } + + private String getToken() { + try { + return get(weChatTokenUrlReplace); + } catch (IOException e) { + log.info("we chat alert get token error{}", e.getMessage()); + } + return null; + } + + static final class WeChatSendMsgResponse { + private Integer errcode; + private String errmsg; + + public WeChatSendMsgResponse() { + } + + public Integer getErrcode() { + return this.errcode; + } + + public void setErrcode(Integer errcode) { + this.errcode = errcode; + } + + public String getErrmsg() { + return this.errmsg; + } + + public void setErrmsg(String errmsg) { + this.errmsg = errmsg; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof WeChatSendMsgResponse)) { + return false; + } + final WeChatSendMsgResponse other = (WeChatSendMsgResponse) o; + final Object this$errcode = this.getErrcode(); + final Object other$errcode = other.getErrcode(); + if (this$errcode == null ? other$errcode != null : !this$errcode.equals(other$errcode)) { + return false; + } + final Object this$errmsg = this.getErrmsg(); + final Object other$errmsg = other.getErrmsg(); + if (this$errmsg == null ? other$errmsg != null : !this$errmsg.equals(other$errmsg)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $errcode = this.getErrcode(); + result = result * PRIME + ($errcode == null ? 43 : $errcode.hashCode()); + final Object $errmsg = this.getErrmsg(); + result = result * PRIME + ($errmsg == null ? 43 : $errmsg.hashCode()); + return result; + } + + public String toString() { + return "WeChatSender.WeChatSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")"; + } + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java similarity index 92% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java index cc62d5aabf..04ecc36482 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.utils.JSONUtils; @@ -34,7 +34,7 @@ public class WeChatAlertChannelFactoryTest { @Test public void testGetParams() { WeChatAlertChannelFactory weChatAlertChannelFactory = new WeChatAlertChannelFactory(); - List params = weChatAlertChannelFactory.getParams(); + List params = weChatAlertChannelFactory.params(); JSONUtils.toJsonString(params); Assert.assertEquals(6, params.size()); } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java similarity index 72% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java index 61010ebe3a..f4934bf920 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSenderTest.java @@ -17,17 +17,16 @@ package org.apache.dolphinscheduler.plugin.alert.wechat; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.apache.dolphinscheduler.spi.alert.ShowType; - -import java.util.HashMap; -import java.util.Map; - +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.AlertResult; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.util.HashMap; +import java.util.Map; + /** * WeChatSenderTest */ @@ -36,24 +35,24 @@ public class WeChatSenderTest { private static Map weChatConfig = new HashMap<>(); private String content = "[{\"id\":\"69\"," - + - "\"name\":\"UserBehavior-0--1193959466\"," - + - "\"Job name\":\"Start workflow\"," - + - "\"State\":\"SUCCESS\"," - + - "\"Recovery\":\"NO\"," - + - "\"Run time\":\"1\"," - + - "\"Start time\": \"2018-08-06 10:31:34.0\"," - + - "\"End time\": \"2018-08-06 10:31:49.0\"," - + - "\"Host\": \"192.168.xx.xx\"," - + - "\"Notify group\" :\"4\"}]"; + + + "\"name\":\"UserBehavior-0--1193959466\"," + + + "\"Job name\":\"Start workflow\"," + + + "\"State\":\"SUCCESS\"," + + + "\"Recovery\":\"NO\"," + + + "\"Run time\":\"1\"," + + + "\"Start time\": \"2018-08-06 10:31:34.0\"," + + + "\"End time\": \"2018-08-06 10:31:49.0\"," + + + "\"Host\": \"192.168.xx.xx\"," + + + "\"Notify group\" :\"4\"}]"; @Before public void initDingTalkConfig() { @@ -62,12 +61,12 @@ public class WeChatSenderTest { weChatConfig.put(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, "NAME_ENTERPRISE_WE_CHAT_CORP_ID"); weChatConfig.put(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, "NAME_ENTERPRISE_WE_CHAT_SECRET"); weChatConfig.put(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG, "{\"touser\":\"{toUser}\",\"agentid\":{agentId}" - + - ",\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"{msg}\"}}" + + + ",\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"{msg}\"}}" ); weChatConfig.put(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, "Kris"); weChatConfig.put(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_TEAM_SEND_MSG, "msg"); - weChatConfig.put(AlertConstants.SHOW_TYPE, ShowType.TABLE.getDescp()); + weChatConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLE.getDescp()); } @Test @@ -80,7 +79,7 @@ public class WeChatSenderTest { @Test public void testSendWeChatTextMsg() { - weChatConfig.put(AlertConstants.SHOW_TYPE, ShowType.TEXT.getDescp()); + weChatConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp()); WeChatSender weChatSender = new WeChatSender(weChatConfig); AlertResult alertResult = weChatSender.sendEnterpriseWeChat("test", content); Assert.assertEquals("false", alertResult.getStatus()); diff --git a/dolphinscheduler-alert-plugin/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/pom.xml similarity index 76% rename from dolphinscheduler-alert-plugin/pom.xml rename to dolphinscheduler-alert/dolphinscheduler-alert-plugins/pom.xml index 0c980aa4f7..1499cd235b 100644 --- a/dolphinscheduler-alert-plugin/pom.xml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-plugins/pom.xml @@ -15,16 +15,16 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + - dolphinscheduler + dolphinscheduler-alert org.apache.dolphinscheduler 2.0.1-SNAPSHOT 4.0.0 - - org.apache.dolphinscheduler - dolphinscheduler-alert-plugin + dolphinscheduler-alert-plugins pom @@ -38,11 +38,9 @@ - org.apache.dolphinscheduler - dolphinscheduler-spi - provided + dolphinscheduler-alert-api diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml b/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml new file mode 100644 index 0000000000..2de2fc9339 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/pom.xml @@ -0,0 +1,130 @@ + + + + + 4.0.0 + + org.apache.dolphinscheduler + dolphinscheduler-alert + 2.0.1-SNAPSHOT + + dolphinscheduler-alert-server + ${project.artifactId} + jar + + + + + org.apache.dolphinscheduler + dolphinscheduler-remote + + + org.apache.dolphinscheduler + dolphinscheduler-alert-dingtalk + + + org.apache.dolphinscheduler + dolphinscheduler-alert-email + + + org.apache.dolphinscheduler + dolphinscheduler-alert-feishu + + + org.apache.dolphinscheduler + dolphinscheduler-alert-http + + + org.apache.dolphinscheduler + dolphinscheduler-alert-script + + + org.apache.dolphinscheduler + dolphinscheduler-alert-slack + + + org.apache.dolphinscheduler + dolphinscheduler-alert-wechat + + + + org.apache.dolphinscheduler + dolphinscheduler-dao + + + + com.fasterxml.jackson.core + jackson-core + + + + com.fasterxml.jackson.core + jackson-databind + + + + com.google.guava + guava + + + jsr305 + com.google.code.findbugs + + + + + ch.qos.logback + logback-classic + + + + + org.apache.poi + poi + + + + org.mockito + mockito-core + test + + + + org.mockito + mockito-inline + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + *.yaml + *.yml + *.xml + + + + + + diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertPluginManager.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertPluginManager.java new file mode 100644 index 0000000000..ca882ca0e7 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertPluginManager.java @@ -0,0 +1,89 @@ +/* + * 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.dolphinscheduler.alert; + +import static java.lang.String.format; + +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; +import org.apache.dolphinscheduler.common.enums.PluginType; +import org.apache.dolphinscheduler.dao.PluginDao; +import org.apache.dolphinscheduler.dao.entity.PluginDefine; +import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; +import org.apache.dolphinscheduler.spi.params.base.PluginParams; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.ServiceLoader; +import java.util.Set; + +import javax.annotation.PostConstruct; + +import org.slf4j.Logger; +import org.springframework.stereotype.Component; + +@Component +public final class AlertPluginManager { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(AlertPluginManager.class); + + private final PluginDao pluginDao; + + private final Map channelKeyedById = new HashMap<>(); + + public AlertPluginManager(PluginDao pluginDao) { + this.pluginDao = pluginDao; + } + + @PostConstruct + public void installPlugin() { + final Set names = new HashSet<>(); + + ServiceLoader.load(AlertChannelFactory.class).forEach(factory -> { + final String name = factory.name(); + + log.info("Registering alert plugin: {}", name); + + if (!names.add(name)) { + throw new IllegalStateException(format("Duplicate alert plugins named '%s'", name)); + } + + final AlertChannel alertChannel = factory.create(); + + log.info("Registered alert plugin: {}", name); + + final List params = factory.params(); + final String paramsJson = PluginParamsTransfer.transferParamsToJson(params); + + final PluginDefine pluginDefine = new PluginDefine(name, PluginType.ALERT.getDesc(), paramsJson); + final int id = pluginDao.addOrUpdatePluginDefine(pluginDefine); + + channelKeyedById.put(id, alertChannel); + }); + } + + public Optional getAlertChannel(int id) { + return Optional.ofNullable(channelKeyedById.get(id)); + } + + public int size() { + return channelKeyedById.size(); + } +} diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessor.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertRequestProcessor.java similarity index 56% rename from dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessor.java rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertRequestProcessor.java index 9421a97546..0db7f70af3 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessor.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertRequestProcessor.java @@ -15,11 +15,10 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.alert.processor; +package org.apache.dolphinscheduler.alert; + +import static com.google.common.base.Preconditions.checkArgument; -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; -import org.apache.dolphinscheduler.alert.runner.AlertSender; -import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.alert.AlertSendRequestCommand; @@ -28,35 +27,33 @@ import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.remote.utils.JsonSerializer; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; +import org.springframework.stereotype.Component; import io.netty.channel.Channel; -public class AlertRequestProcessor implements NettyRequestProcessor { +@Component +public final class AlertRequestProcessor implements NettyRequestProcessor { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(AlertRequestProcessor.class); - private final Logger logger = LoggerFactory.getLogger(AlertRequestProcessor.class); - private final AlertDao alertDao; - private final AlertPluginManager alertPluginManager; + private final AlertSender alertSender; - public AlertRequestProcessor(AlertDao alertDao, AlertPluginManager alertPluginManager) { - this.alertDao = alertDao; - this.alertPluginManager = alertPluginManager; + public AlertRequestProcessor(AlertSender alertSender) { + this.alertSender = alertSender; } @Override public void process(Channel channel, Command command) { - Preconditions.checkArgument(CommandType.ALERT_SEND_REQUEST == command.getType(), - String.format("invalid command type : %s", command.getType())); + checkArgument(CommandType.ALERT_SEND_REQUEST == command.getType(), "invalid command type: %s", command.getType()); AlertSendRequestCommand alertSendRequestCommand = JsonSerializer.deserialize( - command.getBody(), AlertSendRequestCommand.class); - logger.info("received command : {}", alertSendRequestCommand); + command.getBody(), AlertSendRequestCommand.class); - AlertSender alertSender = new AlertSender(alertDao, alertPluginManager); - AlertSendResponseCommand alertSendResponseCommand = alertSender.syncHandler(alertSendRequestCommand.getGroupId(), alertSendRequestCommand.getTitle(), alertSendRequestCommand.getContent()); - channel.writeAndFlush(alertSendResponseCommand.convert2Command(command.getOpaque())); + log.info("Received command : {}", alertSendRequestCommand); + AlertSendResponseCommand alertSendResponseCommand = alertSender.syncHandler( + alertSendRequestCommand.getGroupId(), + alertSendRequestCommand.getTitle(), + alertSendRequestCommand.getContent()); + channel.writeAndFlush(alertSendResponseCommand.convert2Command(command.getOpaque())); } } diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSender.java similarity index 70% rename from dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSender.java index 726dcefba1..ebc57e82bf 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSender.java @@ -15,10 +15,12 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.alert.runner; +package org.apache.dolphinscheduler.alert; -import org.apache.commons.collections.CollectionUtils; -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertData; +import org.apache.dolphinscheduler.alert.api.AlertInfo; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.common.enums.AlertStatus; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.AlertDao; @@ -26,64 +28,50 @@ import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand; import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseResult; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertData; -import org.apache.dolphinscheduler.spi.alert.AlertInfo; -import org.apache.dolphinscheduler.spi.alert.AlertResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; -public class AlertSender { +import org.slf4j.Logger; +import org.springframework.stereotype.Component; - private static final Logger logger = LoggerFactory.getLogger(AlertSender.class); +@Component +public final class AlertSender { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(AlertSender.class); - private List alertList; - private AlertDao alertDao; + private final AlertDao alertDao; private final AlertPluginManager alertPluginManager; - public AlertSender(AlertPluginManager alertPluginManager) { - this.alertPluginManager = alertPluginManager; - } - public AlertSender(AlertDao alertDao, AlertPluginManager alertPluginManager) { - super(); this.alertDao = alertDao; this.alertPluginManager = alertPluginManager; } - public AlertSender(List alertList, AlertDao alertDao, AlertPluginManager alertPluginManager) { - super(); - this.alertList = alertList; - this.alertDao = alertDao; - this.alertPluginManager = alertPluginManager; - } - - public void run() { - for (Alert alert : alertList) { + public void send(List alerts) { + for (Alert alert : alerts) { //get alert group from alert int alertGroupId = alert.getAlertGroupId(); List alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId); if (CollectionUtils.isEmpty(alertInstanceList)) { - logger.error("send alert msg fail,no bind plugin instance."); + log.error("send alert msg fail,no bind plugin instance."); alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "no bind plugin instance", alert.getId()); continue; } AlertData alertData = new AlertData(); alertData.setId(alert.getId()) - .setContent(alert.getContent()) - .setLog(alert.getLog()) - .setTitle(alert.getTitle()); + .setContent(alert.getContent()) + .setLog(alert.getLog()) + .setTitle(alert.getTitle()); for (AlertPluginInstance instance : alertInstanceList) { AlertResult alertResult = this.alertResultHandler(instance, alertData); AlertStatus alertStatus = Boolean.parseBoolean(String.valueOf(alertResult.getStatus())) ? AlertStatus.EXECUTION_SUCCESS : AlertStatus.EXECUTION_FAILURE; alertDao.updateAlert(alertStatus, alertResult.getMessage(), alert.getId()); - } } @@ -98,30 +86,28 @@ public class AlertSender { * @return AlertSendResponseCommand */ public AlertSendResponseCommand syncHandler(int alertGroupId, String title, String content) { - List alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId); AlertData alertData = new AlertData(); alertData.setContent(content) - .setTitle(title); + .setTitle(title); boolean sendResponseStatus = true; List sendResponseResults = new ArrayList<>(); if (CollectionUtils.isEmpty(alertInstanceList)) { - sendResponseStatus = false; AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult(); String message = String.format("Alert GroupId %s send error : not found alert instance", alertGroupId); - alertSendResponseResult.setStatus(sendResponseStatus); + alertSendResponseResult.setStatus(false); alertSendResponseResult.setMessage(message); sendResponseResults.add(alertSendResponseResult); - logger.error("Alert GroupId {} send error : not found alert instance", alertGroupId); - return new AlertSendResponseCommand(sendResponseStatus, sendResponseResults); + log.error("Alert GroupId {} send error : not found alert instance", alertGroupId); + return new AlertSendResponseCommand(false, sendResponseResults); } for (AlertPluginInstance instance : alertInstanceList) { AlertResult alertResult = this.alertResultHandler(instance, alertData); AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult( - Boolean.parseBoolean(String.valueOf(alertResult.getStatus())), alertResult.getMessage()); + Boolean.parseBoolean(String.valueOf(alertResult.getStatus())), alertResult.getMessage()); sendResponseStatus = sendResponseStatus && alertSendResponseResult.getStatus(); sendResponseResults.add(alertSendResponseResult); } @@ -137,15 +123,14 @@ public class AlertSender { * @return AlertResult */ private AlertResult alertResultHandler(AlertPluginInstance instance, AlertData alertData) { - String pluginName = alertPluginManager.getPluginNameById(instance.getPluginDefineId()); - AlertChannel alertChannel = alertPluginManager.getAlertChannelMap().get(pluginName); + Optional alertChannel = alertPluginManager.getAlertChannel(instance.getPluginDefineId()); AlertResult alertResultExtend = new AlertResult(); String pluginInstanceName = instance.getInstanceName(); - if (alertChannel == null) { + if (!alertChannel.isPresent()) { String message = String.format("Alert Plugin %s send error : return value is null", pluginInstanceName); alertResultExtend.setStatus(String.valueOf(false)); alertResultExtend.setMessage(message); - logger.error("Alert Plugin {} send error : not found plugin {}", pluginInstanceName, pluginName); + log.error("Alert Plugin {} send error : not found plugin {}", pluginInstanceName, instance.getPluginDefineId()); return alertResultExtend; } @@ -155,29 +140,27 @@ public class AlertSender { alertInfo.setAlertParams(paramsMap); AlertResult alertResult; try { - alertResult = alertChannel.process(alertInfo); + alertResult = alertChannel.get().process(alertInfo); } catch (Exception e) { alertResult = new AlertResult("false", e.getMessage()); - logger.error("send alert error alert data id :{},", alertData.getId(), e); + log.error("send alert error alert data id :{},", alertData.getId(), e); } - if (alertResult == null) { String message = String.format("Alert Plugin %s send error : return alertResult value is null", pluginInstanceName); alertResultExtend.setStatus(String.valueOf(false)); alertResultExtend.setMessage(message); - logger.info("Alert Plugin {} send error : return alertResult value is null", pluginInstanceName); + log.info("Alert Plugin {} send error : return alertResult value is null", pluginInstanceName); } else if (!Boolean.parseBoolean(String.valueOf(alertResult.getStatus()))) { alertResultExtend.setStatus(String.valueOf(false)); alertResultExtend.setMessage(alertResult.getMessage()); - logger.info("Alert Plugin {} send error : {}", pluginInstanceName, alertResult.getMessage()); + log.info("Alert Plugin {} send error : {}", pluginInstanceName, alertResult.getMessage()); } else { String message = String.format("Alert Plugin %s send success", pluginInstanceName); alertResultExtend.setStatus(String.valueOf(true)); alertResultExtend.setMessage(message); - logger.info("Alert Plugin {} send success", pluginInstanceName); + log.info("Alert Plugin {} send success", pluginInstanceName); } return alertResultExtend; } - } diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java new file mode 100644 index 0000000000..b3dfa62807 --- /dev/null +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java @@ -0,0 +1,125 @@ +/* + * 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.dolphinscheduler.alert; + +import static org.apache.dolphinscheduler.common.Constants.ALERT_RPC_PORT; + +import org.apache.dolphinscheduler.common.thread.Stopper; +import org.apache.dolphinscheduler.dao.AlertDao; +import org.apache.dolphinscheduler.dao.PluginDao; +import org.apache.dolphinscheduler.dao.entity.Alert; +import org.apache.dolphinscheduler.remote.NettyRemotingServer; +import org.apache.dolphinscheduler.remote.command.CommandType; +import org.apache.dolphinscheduler.remote.config.NettyServerConfig; + +import java.io.Closeable; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@EnableAutoConfiguration +@ComponentScan(value = { + "org.apache.dolphinscheduler.alert", + "org.apache.dolphinscheduler.dao" +}) +public class AlertServer implements Closeable { + private static final Logger log = LoggerFactory.getLogger(AlertServer.class); + + private final PluginDao pluginDao; + private final AlertDao alertDao; + private final AlertPluginManager alertPluginManager; + private final AlertSender alertSender; + private final AlertRequestProcessor alertRequestProcessor; + + private NettyRemotingServer server; + + public AlertServer(PluginDao pluginDao, AlertDao alertDao, AlertPluginManager alertPluginManager, AlertSender alertSender, AlertRequestProcessor alertRequestProcessor) { + this.pluginDao = pluginDao; + this.alertDao = alertDao; + this.alertPluginManager = alertPluginManager; + this.alertSender = alertSender; + this.alertRequestProcessor = alertRequestProcessor; + } + + public static void main(String[] args) { + SpringApplication.run(AlertServer.class, args); + } + + @PostConstruct + public void start() { + log.info("Starting Alert server"); + + checkTable(); + startServer(); + + if (alertPluginManager.size() == 0) { + log.warn("No alert plugin, alert sender will exit."); + return; + } + + Executors.newScheduledThreadPool(1) + .scheduleAtFixedRate(new Sender(), 5, 5, TimeUnit.SECONDS); + } + + @Override + @PreDestroy + public void close() { + server.close(); + } + + private void checkTable() { + if (!pluginDao.checkPluginDefineTableExist()) { + log.error("Plugin Define Table t_ds_plugin_define Not Exist . Please Create it First !"); + System.exit(1); + } + } + + private void startServer() { + NettyServerConfig serverConfig = new NettyServerConfig(); + serverConfig.setListenPort(ALERT_RPC_PORT); + + server = new NettyRemotingServer(serverConfig); + server.registerProcessor(CommandType.ALERT_SEND_REQUEST, alertRequestProcessor); + server.start(); + } + + final class Sender implements Runnable { + @Override + public void run() { + if (!Stopper.isRunning()) { + return; + } + + try { + final List alerts = alertDao.listPendingAlerts(); + alertSender.send(alerts); + } catch (Exception e) { + log.error("Failed to send alert", e); + } + } + } +} diff --git a/dolphinscheduler-alert/src/main/resources/logback-alert.xml b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/logback-alert.xml similarity index 95% rename from dolphinscheduler-alert/src/main/resources/logback-alert.xml rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/logback-alert.xml index 1718947dd1..48b3c35bff 100644 --- a/dolphinscheduler-alert/src/main/resources/logback-alert.xml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/logback-alert.xml @@ -17,7 +17,7 @@ --> - + @@ -49,4 +49,4 @@ - \ No newline at end of file + diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java similarity index 57% rename from dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java index 5c31225edc..b1f8e54240 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java @@ -17,54 +17,62 @@ package org.apache.dolphinscheduler.alert.plugin; +import org.apache.dolphinscheduler.alert.AlertPluginManager; +import org.apache.dolphinscheduler.alert.AlertSender; import org.apache.dolphinscheduler.alert.AlertServer; -import org.apache.dolphinscheduler.alert.runner.AlertSender; -import org.apache.dolphinscheduler.alert.utils.Constants; +import org.apache.dolphinscheduler.alert.api.AlertConstants; +import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.common.enums.AlertStatus; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.apache.dolphinscheduler.common.utils.JSONUtils; -import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.AlertDao; -import org.apache.dolphinscheduler.dao.DaoFactory; import org.apache.dolphinscheduler.dao.PluginDao; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.dao.entity.AlertGroup; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.dao.entity.PluginDefine; -import org.apache.dolphinscheduler.spi.alert.AlertConstants; -import org.apache.dolphinscheduler.spi.alert.ShowType; -import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.PasswordParam; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; -import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.apache.dolphinscheduler.spi.params.base.DataType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; -import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; -import org.junit.Assert; -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -/** - * test load and use alert plugin - */ +@ActiveProfiles(ProfileType.H2) +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AlertServer.class) public class EmailAlertPluginTest { - - private AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); - private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); + @Autowired + private AlertDao alertDao; + @Autowired + private PluginDao pluginDao; + @Autowired + private AlertPluginManager manager; + @Autowired + private AlertSender alertSender; + + @BeforeClass + public static void setUpClass() { + System.setProperty("spring.profiles.active", "h2"); + } @Test public void testRunSend() { - //create alert group AlertGroup alertGroup = new AlertGroup(); alertGroup.setDescription("test alert group 1"); @@ -78,7 +86,7 @@ public class EmailAlertPluginTest { map1.put("mysql service name", "mysql200"); map1.put("mysql address", "192.168.xx.xx"); map1.put("port", "3306"); - map1.put(AlertConstants.SHOW_TYPE, ShowType.TEXT.getDescp()); + map1.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp()); map1.put("no index of number", "80"); map1.put("database client connections", "190"); @@ -87,7 +95,7 @@ public class EmailAlertPluginTest { map2.put("mysql address", "192.168.xx.xx"); map2.put("port", "3306"); map2.put("no index of number", "10"); - map1.put(AlertConstants.SHOW_TYPE, ShowType.TABLE.getDescp()); + map1.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLE.getDescp()); map2.put("database client connections", "90"); List> maps = new ArrayList<>(); @@ -102,42 +110,20 @@ public class EmailAlertPluginTest { List alertList = new ArrayList<>(); alertList.add(alert1); - //load email alert plugin - AlertPluginManager alertPluginManager = new AlertPluginManager(); - DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); - String path = DolphinPluginLoader.class.getClassLoader().getResource("").getPath(); - alertPluginManagerConfig.setPlugins(path + "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml"); - if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR))) { - alertPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); - } - - if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY))) { - alertPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY).trim()); - } - - DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); - try { - alertPluginLoader.loadPlugins(); - } catch (Exception e) { - throw new RuntimeException("load Alert Plugin Failed !", e); - } - //create email alert plugin instance AlertPluginInstance alertPluginInstance = new AlertPluginInstance(); alertPluginInstance.setCreateTime(new Date()); alertPluginInstance.setInstanceName("test email alert"); - List pluginDefineList = pluginDao.getPluginDefineMapper().queryByNameAndType("Email", "alert"); - if (pluginDefineList == null || pluginDefineList.size() == 0) { + PluginDefine pluginDefine = pluginDao.getPluginDefineMapper().queryByNameAndType("Email", "alert"); + if (pluginDefine == null) { throw new RuntimeException("no alert plugin be load"); } - PluginDefine pluginDefine = pluginDefineList.get(0); alertPluginInstance.setPluginDefineId(pluginDefine.getId()); alertPluginInstance.setPluginInstanceParams(getEmailAlertParams()); alertDao.getAlertPluginInstanceMapper().insert(alertPluginInstance); - AlertSender alertSender = new AlertSender(alertList, alertDao, alertPluginManager); - alertSender.run(); + alertSender.send(alertList); Alert alertResult = alertDao.getAlertMapper().selectById(alert1.getId()); Assert.assertNotNull(alertResult); @@ -153,74 +139,74 @@ public class EmailAlertPluginTest { List paramsList = new ArrayList<>(); InputParam receivesParam = InputParam.newBuilder("receivers", "receivers") - .setValue("540957506@qq.com") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + .setValue("540957506@qq.com") + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); InputParam mailSmtpHost = InputParam.newBuilder("mailServerHost", "mail.smtp.host") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("smtp.exmail.qq.com") - .build(); + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("smtp.exmail.qq.com") + .build(); InputParam mailSmtpPort = InputParam.newBuilder("mailServerPort", "mail.smtp.port") - .addValidate(Validate.newBuilder() - .setRequired(true) - .setType(DataType.NUMBER.getDataType()) - .build()) - .setValue(25) - .build(); + .addValidate(Validate.newBuilder() + .setRequired(true) + .setType(DataType.NUMBER.getDataType()) + .build()) + .setValue(25) + .build(); InputParam mailSender = InputParam.newBuilder("mailSender", "mail.sender") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("easyscheduler@analysys.com.cn") - .build(); + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("easyscheduler@analysys.com.cn") + .build(); RadioParam enableSmtpAuth = RadioParam.newBuilder("enableSmtpAuth", "mail.smtp.auth") - .addParamsOptions(new ParamsOptions("YES", true, false)) - .addParamsOptions(new ParamsOptions("NO", false, false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue(true) - .build(); + .addParamsOptions(new ParamsOptions("YES", true, false)) + .addParamsOptions(new ParamsOptions("NO", false, false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue(true) + .build(); InputParam mailUser = InputParam.newBuilder("mailUser", "mail.user") - .setPlaceholder("if enable use authentication, you need input user") - .setValue("easyscheduler@analysys.com.cn") - .build(); + .setPlaceholder("if enable use authentication, you need input user") + .setValue("easyscheduler@analysys.com.cn") + .build(); PasswordParam mailPassword = PasswordParam.newBuilder("mailPasswd", "mail.passwd") - .setPlaceholder("if enable use authentication, you need input password") - .setValue("xxxxxxx") - .build(); + .setPlaceholder("if enable use authentication, you need input password") + .setValue("xxxxxxx") + .build(); RadioParam enableTls = RadioParam.newBuilder("starttlsEnable", "mail.smtp.starttls.enable") - .addParamsOptions(new ParamsOptions("YES", true, false)) - .addParamsOptions(new ParamsOptions("NO", false, false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue(true) - .build(); + .addParamsOptions(new ParamsOptions("YES", true, false)) + .addParamsOptions(new ParamsOptions("NO", false, false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue(true) + .build(); RadioParam enableSsl = RadioParam.newBuilder("sslEnable", "mail.smtp.ssl.enable") - .addParamsOptions(new ParamsOptions("YES", true, false)) - .addParamsOptions(new ParamsOptions("NO", false, false)) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue(false) - .build(); + .addParamsOptions(new ParamsOptions("YES", true, false)) + .addParamsOptions(new ParamsOptions("NO", false, false)) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue(false) + .build(); InputParam sslTrust = InputParam.newBuilder("mailSmtpSslTrust", "mail.smtp.ssl.trust") - .addValidate(Validate.newBuilder().setRequired(true).build()) - .setValue("smtp.exmail.qq.com") - .build(); + .addValidate(Validate.newBuilder().setRequired(true).build()) + .setValue("smtp.exmail.qq.com") + .build(); List emailShowTypeList = new ArrayList<>(); emailShowTypeList.add(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false)); emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false)); - RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType") - .setOptions(emailShowTypeList) - .setValue(ShowType.TABLE.getDescp()) - .addValidate(Validate.newBuilder().setRequired(true).build()) - .build(); + RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, "showType") + .setOptions(emailShowTypeList) + .setValue(ShowType.TABLE.getDescp()) + .addValidate(Validate.newBuilder().setRequired(true).build()) + .build(); paramsList.add(receivesParam); paramsList.add(mailSmtpHost); diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java similarity index 77% rename from dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java index 052d2f3d55..20e67687a4 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/processor/AlertRequestProcessorTest.java @@ -17,7 +17,10 @@ package org.apache.dolphinscheduler.alert.processor; -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; +import static org.mockito.Mockito.mock; + +import org.apache.dolphinscheduler.alert.AlertRequestProcessor; +import org.apache.dolphinscheduler.alert.AlertSender; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; @@ -26,30 +29,21 @@ import org.apache.dolphinscheduler.remote.command.alert.AlertSendRequestCommand; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.powermock.api.mockito.PowerMockito; import io.netty.channel.Channel; -/** - * alert request processor test - */ public class AlertRequestProcessorTest { - - private AlertDao alertDao; - private AlertPluginManager alertPluginManager; - private AlertRequestProcessor alertRequestProcessor; @Before public void before() { - alertDao = PowerMockito.mock(AlertDao.class); - alertPluginManager = PowerMockito.mock(AlertPluginManager.class); - alertRequestProcessor = new AlertRequestProcessor(alertDao, alertPluginManager); + final AlertDao alertDao = mock(AlertDao.class); + alertRequestProcessor = new AlertRequestProcessor(new AlertSender(alertDao, null)); } @Test public void testProcess() { - Channel channel = PowerMockito.mock(Channel.class); + Channel channel = mock(Channel.class); AlertSendRequestCommand alertSendRequestCommand = new AlertSendRequestCommand(1, "title", "content"); Command reqCommand = alertSendRequestCommand.convert2Command(); Assert.assertEquals(CommandType.ALERT_SEND_REQUEST, reqCommand.getType()); diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java similarity index 60% rename from dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java rename to dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java index 3b84bdbe67..160afeb5d9 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderTest.java @@ -17,34 +17,32 @@ package org.apache.dolphinscheduler.alert.runner; -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.dolphinscheduler.alert.AlertPluginManager; +import org.apache.dolphinscheduler.alert.AlertSender; +import org.apache.dolphinscheduler.alert.api.AlertChannel; +import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.PluginDao; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.dao.entity.PluginDefine; import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertResult; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; +import java.util.Optional; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * alert sender test - */ public class AlertSenderTest { - private static final Logger logger = LoggerFactory.getLogger(AlertSenderTest.class); private AlertDao alertDao; @@ -55,10 +53,9 @@ public class AlertSenderTest { @Before public void before() { - alertDao = PowerMockito.mock(AlertDao.class); - pluginDao = PowerMockito.mock(PluginDao.class); - alertPluginManager = PowerMockito.mock(AlertPluginManager.class); - + alertDao = mock(AlertDao.class); + pluginDao = mock(PluginDao.class); + alertPluginManager = mock(AlertPluginManager.class); } @Test @@ -70,12 +67,12 @@ public class AlertSenderTest { alertSender = new AlertSender(alertDao, alertPluginManager); //1.alert instance does not exist - PowerMockito.when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(null); + when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(null); AlertSendResponseCommand alertSendResponseCommand = alertSender.syncHandler(alertGroupId, title, content); Assert.assertFalse(alertSendResponseCommand.getResStatus()); alertSendResponseCommand.getResResults().forEach(result -> - logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); + logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); //2.alert plugin does not exist int pluginDefineId = 1; @@ -83,59 +80,52 @@ public class AlertSenderTest { String pluginInstanceName = "alert-instance-mail"; List alertInstanceList = new ArrayList<>(); AlertPluginInstance alertPluginInstance = new AlertPluginInstance( - pluginDefineId, pluginInstanceParams, pluginInstanceName); + pluginDefineId, pluginInstanceParams, pluginInstanceName); alertInstanceList.add(alertPluginInstance); - PowerMockito.when(alertDao.listInstanceByAlertGroupId(1)).thenReturn(alertInstanceList); + when(alertDao.listInstanceByAlertGroupId(1)).thenReturn(alertInstanceList); String pluginName = "alert-plugin-mail"; PluginDefine pluginDefine = new PluginDefine(pluginName, "1", null); - PowerMockito.when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine); + when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine); alertSendResponseCommand = alertSender.syncHandler(alertGroupId, title, content); Assert.assertFalse(alertSendResponseCommand.getResStatus()); alertSendResponseCommand.getResResults().forEach(result -> - logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); + logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); //3.alert result value is null - AlertChannel alertChannelMock = PowerMockito.mock(AlertChannel.class); - PowerMockito.when(alertChannelMock.process(Mockito.any())).thenReturn(null); - Map alertChannelMap = new ConcurrentHashMap<>(); - alertChannelMap.put(pluginName, alertChannelMock); - PowerMockito.when(alertPluginManager.getAlertChannelMap()).thenReturn(alertChannelMap); - PowerMockito.when(alertPluginManager.getPluginNameById(Mockito.anyInt())).thenReturn("alert-plugin-mail"); + AlertChannel alertChannelMock = mock(AlertChannel.class); + when(alertChannelMock.process(Mockito.any())).thenReturn(null); + when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock)); alertSendResponseCommand = alertSender.syncHandler(alertGroupId, title, content); Assert.assertFalse(alertSendResponseCommand.getResStatus()); alertSendResponseCommand.getResResults().forEach(result -> - logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); + logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); //4.abnormal information inside the alert plug-in code AlertResult alertResult = new AlertResult(); alertResult.setStatus(String.valueOf(false)); alertResult.setMessage("Abnormal information inside the alert plug-in code"); - PowerMockito.when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); - alertChannelMap = new ConcurrentHashMap<>(); - alertChannelMap.put(pluginName, alertChannelMock); - PowerMockito.when(alertPluginManager.getAlertChannelMap()).thenReturn(alertChannelMap); + when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); + when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock)); alertSendResponseCommand = alertSender.syncHandler(alertGroupId, title, content); Assert.assertFalse(alertSendResponseCommand.getResStatus()); alertSendResponseCommand.getResResults().forEach(result -> - logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); + logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); //5.alert plugin send success alertResult = new AlertResult(); alertResult.setStatus(String.valueOf(true)); alertResult.setMessage(String.format("Alert Plugin %s send success", pluginInstanceName)); - PowerMockito.when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); - alertChannelMap = new ConcurrentHashMap<>(); - alertChannelMap.put(pluginName, alertChannelMock); - PowerMockito.when(alertPluginManager.getAlertChannelMap()).thenReturn(alertChannelMap); + when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); + when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock)); alertSendResponseCommand = alertSender.syncHandler(alertGroupId, title, content); Assert.assertTrue(alertSendResponseCommand.getResStatus()); alertSendResponseCommand.getResResults().forEach(result -> - logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); + logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage())); } @@ -151,33 +141,28 @@ public class AlertSenderTest { alert.setContent(content); alertList.add(alert); - alertSender = new AlertSender(alertList, alertDao, alertPluginManager); + alertSender = new AlertSender(alertDao, alertPluginManager); int pluginDefineId = 1; String pluginInstanceParams = "alert-instance-mail-params"; String pluginInstanceName = "alert-instance-mail"; List alertInstanceList = new ArrayList<>(); AlertPluginInstance alertPluginInstance = new AlertPluginInstance( - pluginDefineId, pluginInstanceParams, pluginInstanceName); + pluginDefineId, pluginInstanceParams, pluginInstanceName); alertInstanceList.add(alertPluginInstance); - PowerMockito.when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(alertInstanceList); + when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(alertInstanceList); String pluginName = "alert-plugin-mail"; PluginDefine pluginDefine = new PluginDefine(pluginName, "1", null); - PowerMockito.when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine); - PowerMockito.when(alertPluginManager.getPluginNameById(1)).thenReturn("alert-instance-mail"); + when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine); AlertResult alertResult = new AlertResult(); alertResult.setStatus(String.valueOf(true)); alertResult.setMessage(String.format("Alert Plugin %s send success", pluginInstanceName)); - AlertChannel alertChannelMock = PowerMockito.mock(AlertChannel.class); - PowerMockito.when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); - ConcurrentHashMap alertChannelMap = new ConcurrentHashMap<>(); - alertChannelMap.put(pluginName, alertChannelMock); - PowerMockito.when(alertPluginManager.getAlertChannelMap()).thenReturn(alertChannelMap); + AlertChannel alertChannelMock = mock(AlertChannel.class); + when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult); + when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock)); Assert.assertTrue(Boolean.parseBoolean(alertResult.getStatus())); - alertSender.run(); - + alertSender.send(alertList); } - } diff --git a/dolphinscheduler-alert/pom.xml b/dolphinscheduler-alert/pom.xml index 3bcccb1207..34605601a5 100644 --- a/dolphinscheduler-alert/pom.xml +++ b/dolphinscheduler-alert/pom.xml @@ -1,125 +1,50 @@ - - 4.0.0 + - org.apache.dolphinscheduler dolphinscheduler + org.apache.dolphinscheduler 2.0.1-SNAPSHOT + 4.0.0 + pom dolphinscheduler-alert - ${project.artifactId} - jar - - - UTF-8 - - - - - org.apache.dolphinscheduler - dolphinscheduler-remote - - - - org.apache.dolphinscheduler - dolphinscheduler-dao - - - log4j-api - org.apache.logging.log4j - - - - - junit - junit - test - - - - com.fasterxml.jackson.core - jackson-core - - - - com.fasterxml.jackson.core - jackson-databind - + + dolphinscheduler-alert-api + dolphinscheduler-alert-plugins + dolphinscheduler-alert-server + + org.slf4j slf4j-api - - com.google.guava - guava - - - jsr305 - com.google.code.findbugs - - - - - ch.qos.logback - logback-classic - - - - - org.apache.poi - poi - - - - org.powermock - powermock-module-junit4 - test - - - - org.mockito - mockito-core - test - - - - org.powermock - powermock-api-mockito2 - test - - - org.mockito - mockito-core - - - - - - org.jacoco - org.jacoco.agent - runtime + org.springframework.boot + spring-boot-starter-test test - diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java deleted file mode 100644 index b0a8c0348d..0000000000 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java +++ /dev/null @@ -1,156 +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.dolphinscheduler.alert; - -import static org.apache.dolphinscheduler.alert.utils.Constants.ALERT_PROPERTIES_PATH; -import static org.apache.dolphinscheduler.common.Constants.ALERT_RPC_PORT; - -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; -import org.apache.dolphinscheduler.alert.processor.AlertRequestProcessor; -import org.apache.dolphinscheduler.alert.runner.AlertSender; -import org.apache.dolphinscheduler.alert.utils.Constants; -import org.apache.dolphinscheduler.common.thread.Stopper; -import org.apache.dolphinscheduler.common.utils.PropertyUtils; -import org.apache.dolphinscheduler.dao.AlertDao; -import org.apache.dolphinscheduler.dao.DaoFactory; -import org.apache.dolphinscheduler.dao.PluginDao; -import org.apache.dolphinscheduler.dao.entity.Alert; -import org.apache.dolphinscheduler.remote.NettyRemotingServer; -import org.apache.dolphinscheduler.remote.command.CommandType; -import org.apache.dolphinscheduler.remote.config.NettyServerConfig; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.ImmutableList; - -public class AlertServer { - - private static final Logger logger = LoggerFactory.getLogger(AlertServer.class); - - private final PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); - - private final AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); - - private AlertPluginManager alertPluginManager; - - public static final String ALERT_PLUGIN_BINDING = "alert.plugin.binding"; - - public static final String ALERT_PLUGIN_DIR = "alert.plugin.dir"; - - public static final String MAVEN_LOCAL_REPOSITORY = "maven.local.repository"; - - private NettyRemotingServer server; - - private static class AlertServerHolder { - private static final AlertServer INSTANCE = new AlertServer(); - } - - public static AlertServer getInstance() { - return AlertServerHolder.INSTANCE; - } - - private AlertServer() { - - } - - private void checkTable() { - if (!pluginDao.checkPluginDefineTableExist()) { - logger.error("Plugin Define Table t_ds_plugin_define Not Exist . Please Create it First !"); - System.exit(1); - } - } - - private void initPlugin() { - DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); - alertPluginManagerConfig.setPlugins(PropertyUtils.getString(ALERT_PLUGIN_BINDING)); - if (StringUtils.isNotBlank(PropertyUtils.getString(ALERT_PLUGIN_DIR))) { - alertPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); - } - - if (StringUtils.isNotBlank(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY))) { - alertPluginManagerConfig.setMavenLocalRepository(PropertyUtils.getString(MAVEN_LOCAL_REPOSITORY).trim()); - } - - alertPluginManager = new AlertPluginManager(); - DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); - try { - alertPluginLoader.loadPlugins(); - } catch (Exception e) { - throw new RuntimeException("Load Alert Plugin Failed !", e); - } - } - - private void initRemoteServer() { - NettyServerConfig serverConfig = new NettyServerConfig(); - serverConfig.setListenPort(ALERT_RPC_PORT); - this.server = new NettyRemotingServer(serverConfig); - this.server.registerProcessor(CommandType.ALERT_SEND_REQUEST, new AlertRequestProcessor(alertDao, alertPluginManager)); - this.server.start(); - } - - private void runSender() { - new Thread(new Sender()).start(); - } - - public void start() { - PropertyUtils.loadPropertyFile(ALERT_PROPERTIES_PATH); - checkTable(); - initPlugin(); - initRemoteServer(); - logger.info("alert server ready start "); - runSender(); - } - - public void stop() { - this.server.close(); - logger.info("alert server shut down"); - } - - final class Sender implements Runnable { - @Override - public void run() { - while (Stopper.isRunning()) { - try { - Thread.sleep(Constants.ALERT_SCAN_INTERVAL); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - Thread.currentThread().interrupt(); - } - if (alertPluginManager == null || alertPluginManager.getAlertChannelMap().size() == 0) { - logger.warn("No Alert Plugin . Cannot send alert info. "); - } else { - List alerts = alertDao.listWaitExecutionAlert(); - new AlertSender(alerts, alertDao, alertPluginManager).run(); - } - } - } - } - - public static void main(String[] args) { - AlertServer alertServer = AlertServer.getInstance(); - alertServer.start(); - Runtime.getRuntime().addShutdownHook(new Thread(alertServer::stop)); - } - -} diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManager.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManager.java deleted file mode 100644 index 02f4b0ff8a..0000000000 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManager.java +++ /dev/null @@ -1,115 +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.dolphinscheduler.alert.plugin; - -import static java.lang.String.format; -import static java.util.Objects.requireNonNull; - -import static com.google.common.base.Preconditions.checkState; - -import org.apache.dolphinscheduler.common.enums.PluginType; -import org.apache.dolphinscheduler.spi.plugin.AbstractDolphinPluginManager; -import org.apache.dolphinscheduler.dao.DaoFactory; -import org.apache.dolphinscheduler.dao.PluginDao; -import org.apache.dolphinscheduler.dao.entity.PluginDefine; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.classloader.ThreadContextClassLoader; -import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; -import org.apache.dolphinscheduler.spi.params.base.PluginParams; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * load the configured alert plugin and manager them - */ -public class AlertPluginManager extends AbstractDolphinPluginManager { - private static final Logger logger = LoggerFactory.getLogger(AlertPluginManager.class); - - private final Map alertChannelFactoryMap = new ConcurrentHashMap<>(); - private final Map alertChannelMap = new ConcurrentHashMap<>(); - - /** - * k->pluginDefineId v->pluginDefineName - */ - private final Map pluginDefineMap = new HashMap<>(); - - private final PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); - - private void addAlertChannelFactory(AlertChannelFactory alertChannelFactory) { - requireNonNull(alertChannelFactory, "alertChannelFactory is null"); - - if (alertChannelFactoryMap.putIfAbsent(alertChannelFactory.getName(), alertChannelFactory) != null) { - throw new IllegalArgumentException(format("Alert Plugin '%s' is already registered", alertChannelFactory.getName())); - } - - try { - loadAlertChannel(alertChannelFactory.getName()); - } catch (Exception e) { - throw new IllegalArgumentException(format("Alert Plugin '%s' is can not load .", alertChannelFactory.getName())); - } - } - - private void loadAlertChannel(String name) { - requireNonNull(name, "name is null"); - - AlertChannelFactory alertChannelFactory = alertChannelFactoryMap.get(name); - checkState(alertChannelFactory != null, "Alert Plugin %s is not registered", name); - - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(alertChannelFactory.getClass().getClassLoader())) { - AlertChannel alertChannel = alertChannelFactory.create(); - this.alertChannelMap.put(name, alertChannel); - } - - logger.info("-- Loaded Alert Plugin {} --", name); - } - - Map getAlertChannelFactoryMap() { - return alertChannelFactoryMap; - } - - public Map getAlertChannelMap() { - return alertChannelMap; - } - - public String getPluginNameById(int id) { - return pluginDefineMap.get(id); - } - - @Override - public void installPlugin(DolphinSchedulerPlugin dolphinSchedulerPlugin) { - for (AlertChannelFactory alertChannelFactory : dolphinSchedulerPlugin.getAlertChannelFactorys()) { - logger.info("Registering Alert Plugin '{}'", alertChannelFactory.getName()); - this.addAlertChannelFactory(alertChannelFactory); - List params = alertChannelFactory.getParams(); - String nameEn = alertChannelFactory.getName(); - String paramsJson = PluginParamsTransfer.transferParamsToJson(params); - - PluginDefine pluginDefine = new PluginDefine(nameEn, PluginType.ALERT.getDesc(), paramsJson); - int id = pluginDao.addOrUpdatePluginDefine(pluginDefine); - pluginDefineMap.put(id, pluginDefine.getPluginName()); - } - } -} diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java deleted file mode 100644 index 077f7ac26c..0000000000 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java +++ /dev/null @@ -1,38 +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.dolphinscheduler.alert.utils; - -/** - * constants - */ -public class Constants { - private Constants() { - throw new IllegalStateException("Constants class"); - } - - /** - * alert properties path - */ - public static final String ALERT_PROPERTIES_PATH = "/alert.properties"; - - /** default alert plugin dir **/ - public static final String ALERT_PLUGIN_PATH = "lib/plugin/alert"; - - public static final int ALERT_SCAN_INTERVAL = 5000; - -} diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java deleted file mode 100644 index 38fb6b055e..0000000000 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java +++ /dev/null @@ -1,91 +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.dolphinscheduler.alert; - -import org.apache.dolphinscheduler.alert.plugin.AlertPluginManager; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; -import org.apache.dolphinscheduler.alert.runner.AlertSender; -import org.apache.dolphinscheduler.alert.utils.Constants; -import org.apache.dolphinscheduler.dao.AlertDao; -import org.apache.dolphinscheduler.dao.DaoFactory; -import org.apache.dolphinscheduler.dao.PluginDao; -import org.apache.dolphinscheduler.remote.NettyRemotingServer; -import org.apache.dolphinscheduler.spi.alert.AlertChannel; - -import java.util.concurrent.ConcurrentHashMap; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({AlertServer.class, DaoFactory.class}) -public class AlertServerTest { - - @Before - public void before() { - - } - - @Test - public void testMain() throws Exception { - AlertDao alertDao = PowerMockito.mock(AlertDao.class); - PowerMockito.mockStatic(DaoFactory.class); - PowerMockito.when(DaoFactory.getDaoInstance(AlertDao.class)).thenReturn(alertDao); - - PluginDao pluginDao = PowerMockito.mock(PluginDao.class); - PowerMockito.when(DaoFactory.getDaoInstance(PluginDao.class)).thenReturn(pluginDao); - PowerMockito.when(pluginDao.checkPluginDefineTableExist()).thenReturn(true); - - AlertChannel alertChannelMock = PowerMockito.mock(AlertChannel.class); - - AlertPluginManager alertPluginManager = PowerMockito.mock(AlertPluginManager.class); - PowerMockito.whenNew(AlertPluginManager.class).withNoArguments().thenReturn(alertPluginManager); - ConcurrentHashMap alertChannelMap = new ConcurrentHashMap<>(); - alertChannelMap.put("pluginName", alertChannelMock); - PowerMockito.when(alertPluginManager.getPluginNameById(Mockito.anyInt())).thenReturn("pluginName"); - PowerMockito.when(alertPluginManager.getAlertChannelMap()).thenReturn(alertChannelMap); - - DolphinPluginManagerConfig alertPluginManagerConfig = PowerMockito.mock(DolphinPluginManagerConfig.class); - PowerMockito.whenNew(DolphinPluginManagerConfig.class).withNoArguments().thenReturn(alertPluginManagerConfig); - - NettyRemotingServer nettyRemotingServer = PowerMockito.mock(NettyRemotingServer.class); - PowerMockito.whenNew(NettyRemotingServer.class).withAnyArguments().thenReturn(nettyRemotingServer); - AlertSender alertSender = PowerMockito.mock(AlertSender.class); - PowerMockito.whenNew(AlertSender.class).withAnyArguments().thenReturn(alertSender); - - DolphinPluginLoader dolphinPluginLoader = PowerMockito.mock(DolphinPluginLoader.class); - PowerMockito.whenNew(DolphinPluginLoader.class).withAnyArguments().thenReturn(dolphinPluginLoader); - - AlertServer alertServer = AlertServer.getInstance(); - Assert.assertNotNull(alertServer); - - new Thread(() -> alertServer.start()).start(); - - Thread.sleep(5 * Constants.ALERT_SCAN_INTERVAL); - - alertServer.stop(); - } - -} diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java deleted file mode 100644 index c4518076b6..0000000000 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/AlertPluginManagerTest.java +++ /dev/null @@ -1,67 +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.dolphinscheduler.alert.plugin; - -import org.apache.dolphinscheduler.alert.AlertServer; -import org.apache.dolphinscheduler.alert.utils.Constants; -import org.apache.dolphinscheduler.common.utils.PropertyUtils; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import java.util.Objects; - -import org.junit.Assert; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.ImmutableList; - -/** - * AlertPluginManager Tester. - */ -public class AlertPluginManagerTest { - - private static final Logger logger = LoggerFactory.getLogger(AlertPluginManagerTest.class); - - @Test - public void testLoadPlugins() { - logger.info("begin test AlertPluginManagerTest"); - AlertPluginManager alertPluginManager = new AlertPluginManager(); - DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); - String path = Objects.requireNonNull(DolphinPluginLoader.class.getClassLoader().getResource("")).getPath(); - alertPluginManagerConfig.setPlugins(path + "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml"); - if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR))) { - alertPluginManagerConfig.setInstalledPluginsDir(PropertyUtils.getString(AlertServer.ALERT_PLUGIN_DIR, Constants.ALERT_PLUGIN_PATH).trim()); - } - - if (StringUtils.isNotBlank(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY))) { - alertPluginManagerConfig.setMavenLocalRepository(Objects.requireNonNull(PropertyUtils.getString(AlertServer.MAVEN_LOCAL_REPOSITORY)).trim()); - } - - DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); - try { - //alertPluginLoader.loadPlugins(); - } catch (Exception e) { - throw new RuntimeException("load Alert Plugin Failed !", e); - } - - Assert.assertNull(alertPluginManager.getAlertChannelFactoryMap().get("Email")); - } -} diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/DolphinPluginLoaderTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/DolphinPluginLoaderTest.java deleted file mode 100644 index aceb6a1f72..0000000000 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/DolphinPluginLoaderTest.java +++ /dev/null @@ -1,55 +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.dolphinscheduler.alert.plugin; - -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; - -import java.util.Objects; - -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -/** - * DolphinPluginLoader Tester. - */ -@Ignore("load jar fail,don't care plugin,should mock plugin") -public class DolphinPluginLoaderTest { - - /** - * Method: loadPlugins() - */ - @Test - public void testLoadPlugins() { - AlertPluginManager alertPluginManager = new AlertPluginManager(); - DolphinPluginManagerConfig alertPluginManagerConfig = new DolphinPluginManagerConfig(); - String path = Objects.requireNonNull(DolphinPluginLoader.class.getClassLoader().getResource("")).getPath(); - alertPluginManagerConfig.setPlugins(path + "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml"); - DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(alertPluginManagerConfig, ImmutableList.of(alertPluginManager)); - try { - alertPluginLoader.loadPlugins(); - } catch (Exception e) { - throw new RuntimeException("load Alert Plugin Failed !", e); - } - - Assert.assertNotNull(alertPluginManager.getAlertChannelFactoryMap().get("Email")); - } -} diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/PropertyUtilsTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/PropertyUtilsTest.java deleted file mode 100644 index d72c09ae42..0000000000 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/PropertyUtilsTest.java +++ /dev/null @@ -1,221 +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.dolphinscheduler.alert.utils; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import org.apache.dolphinscheduler.common.enums.NodeType; -import org.apache.dolphinscheduler.common.utils.PropertyUtils; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test PropertyUtils - * and the resource path is src/test/resources/alert.properties. - */ -public class PropertyUtilsTest { - - private static final Logger logger = LoggerFactory.getLogger(PropertyUtilsTest.class); - - /** - * Test getString - */ - @Test - public void testGetString() { - - //Expected "EMAIL" - String result = PropertyUtils.getString("alert.type"); - logger.info(result); - assertEquals("EMAIL", result); - - //Expected "xxx.xxx.test" - result = PropertyUtils.getString("mail.server.host"); - assertEquals("xxx.xxx.test", result); - - //If key is undefine in alert.properties, then return null - result = PropertyUtils.getString("abc"); - assertNull(result); - - //If key is null, then return null - result = PropertyUtils.getString(null); - assertNull(result); - } - - - /** - * Test getBoolean - */ - @Test - public void testGetBoolean() { - - //Expected true - Boolean result = PropertyUtils.getBoolean("mail.smtp.starttls.enable"); - assertTrue(result); - - //Expected false - result = PropertyUtils.getBoolean("mail.smtp.ssl.enable"); - assertFalse(result); - - //If key is undefine in alert.properties, then return null - result = PropertyUtils.getBoolean("abc"); - assertFalse(result); - - //If key is null, then return false - result = PropertyUtils.getBoolean(null); - assertFalse(result); - } - - /** - * Test getLong - */ - @Test - public void testGetLong() { - - //Expected 25 - long result = PropertyUtils.getLong("mail.server.port"); - assertSame(25L, result); - - //If key is null, then return -1 - result = PropertyUtils.getLong(null); - assertSame(-1L, result); - - //If key is undefine in alert.properties, then return -1 - result = PropertyUtils.getLong("abc"); - assertSame(-1L, result); - - //If key is undefine in alert.properties, and there is a defaultval, then return defaultval - result = PropertyUtils.getLong("abc", 200); - assertEquals(200L, result); - - //If the value can not parse to long ,it will log the error and return -1L - result = PropertyUtils.getLong("test.server.testnumber"); - assertSame(-1L, result); - } - - /** - * Test getDouble - */ - @Test - public void testGetDouble() { - - //Expected 3.0 - double result = PropertyUtils.getDouble("test.server.factor", 3.0); - assertEquals(3.0, result, 0); - - //If key is null, then return -1.0 - result = PropertyUtils.getDouble(null, -1.0); - assertEquals(-1.0, result, 0); - - //If key is undefine in alert.properties, then return -1 - result = PropertyUtils.getDouble("abc", -1.0); - assertEquals(-1.0, result, 0); - - //If key is undefine in alert.properties, and there is a defaultval, then return defaultval - result = PropertyUtils.getDouble("abc", 5.0); - assertEquals(5.0, result, 0); - - //If the value can not parse to double ,it will log the error and return -1.0 - result = PropertyUtils.getDouble("test.server.testnumber", -1.0); - assertEquals(-1.0, result, 0); - } - - /** - * Test getArray - */ - @Test - public void testGetArray() { - - //Expected length 3 - String[] result = PropertyUtils.getArray("test.server.list", ","); - assertEquals(result.length, 3); - - //Equal array values - assertEquals("xxx.xxx.test1", result[0]); - assertEquals("xxx.xxx.test2", result[1]); - assertEquals("xxx.xxx.test3", result[2]); - - //If key is null, then return -1 - result = PropertyUtils.getArray(null, ","); - assertNull(result); - - //If key is undefine in alert.properties, then return null - result = PropertyUtils.getArray("abc", ","); - assertNull(result); - - //If splitStr is null, then return null - result = PropertyUtils.getArray("test.server.list", null); - assertNull(result); - } - - /** - * test getInt - */ - @Test - public void testGetInt() { - - //Expected 25 - int result = PropertyUtils.getInt("mail.server.port"); - assertSame(25, result); - - //If key is null, then return -1 - result = PropertyUtils.getInt(null); - assertSame(-1, result); - - //If key is undefine in alert.properties, then return -1 - result = PropertyUtils.getInt("abc"); - assertSame(-1, result); - - //If key is undefine in alert.properties, and there is a defaultval, then return defaultval - result = PropertyUtils.getInt("abc", 300); - assertEquals(300, result); - - //If the value can not parse to int ,it will log the error and return -1 - result = PropertyUtils.getInt("test.server.testnumber"); - assertSame(-1, result); - } - - /** - * Test getEnum - */ - @Test - public void testGetEnum() { - - //Expected MASTER - NodeType nodeType = PropertyUtils.getEnum("test.server.enum1", NodeType.class, NodeType.WORKER); - assertEquals(NodeType.MASTER, nodeType); - - //Expected DEAD_SERVER - nodeType = PropertyUtils.getEnum("test.server.enum2", NodeType.class, NodeType.WORKER); - assertEquals(NodeType.DEAD_SERVER, nodeType); - - //If key is null, then return defaultval - nodeType = PropertyUtils.getEnum(null, NodeType.class, NodeType.WORKER); - assertEquals(NodeType.WORKER, nodeType); - - //If the value doesn't define in enum ,it will log the error and return -1 - nodeType = PropertyUtils.getEnum("test.server.enum3", NodeType.class, NodeType.WORKER); - assertEquals(NodeType.WORKER, nodeType); - } - -} diff --git a/dolphinscheduler-api/pom.xml b/dolphinscheduler-api/pom.xml index 3cdaf249a8..3e002de8ce 100644 --- a/dolphinscheduler-api/pom.xml +++ b/dolphinscheduler-api/pom.xml @@ -34,6 +34,12 @@ dolphinscheduler-service + + org.apache.dolphinscheduler + dolphinscheduler-datasource-all + ${project.version} + + org.springframework.boot @@ -222,12 +228,6 @@ - - junit - junit - test - - org.powermock powermock-module-junit4 @@ -238,20 +238,35 @@ org.powermock powermock-api-mockito2 test + + + + org.apache.curator + curator-test + ${curator.test} - org.mockito - mockito-core + org.javassist + javassist - - - - org.jacoco - org.jacoco.agent - runtime test - + + + + + org.apache.maven.plugins + maven-jar-plugin + + + *.yaml + *.yml + *.xml + + + + + diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java index 6afb9d54c2..9d04857d90 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java @@ -17,21 +17,25 @@ package org.apache.dolphinscheduler.api; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; -@SpringBootApplication +@EnableAutoConfiguration @ServletComponentScan -@ComponentScan(value = "org.apache.dolphinscheduler", - excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.apache.dolphinscheduler.server.*")) +@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { + @ComponentScan.Filter(type = FilterType.REGEX, pattern = { + "org.apache.dolphinscheduler.server.*", + "org.apache.dolphinscheduler.alert.*" + }) +}) public class ApiApplicationServer extends SpringBootServletInitializer { public static void main(String[] args) { - SpringApplication.run(ApiApplicationServer.class, args); + new SpringApplicationBuilder(ApiApplicationServer.class).profiles("api").run(args); } } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java index 34ce49a0dc..a449a872a4 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java @@ -34,13 +34,13 @@ import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.DataSourceService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.datasource.DatasourceUtil; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Map; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java index dc1637e204..d240847155 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java @@ -18,10 +18,10 @@ package org.apache.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.dao.entity.User; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Map; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java index bd29aa8168..aa640b1816 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java @@ -22,16 +22,17 @@ import org.apache.dolphinscheduler.api.service.DataSourceService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.datasource.DatasourceUtil; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.lang.StringUtils; @@ -316,7 +317,7 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource @Override public Result checkConnection(DbType type, ConnectionParam connectionParam) { Result result = new Result<>(); - try (Connection connection = DatasourceUtil.getConnection(type, connectionParam)) { + try (Connection connection = DataSourceClientProvider.getInstance().getConnection(type, connectionParam)) { if (connection == null) { putMsg(result, Status.CONNECTION_TEST_FAILURE); return result; diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/HttpClientTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/HttpClientTest.java deleted file mode 100644 index 6753d93d44..0000000000 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/HttpClientTest.java +++ /dev/null @@ -1,157 +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.dolphinscheduler.api; - -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -public class HttpClientTest { - - private static final Logger logger = LoggerFactory.getLogger(HttpClientTest.class); - - @Test - public void doPOSTParam()throws Exception{ - // create HttpClient - CloseableHttpClient httpclient = HttpClients.createDefault(); - - // create http post request - HttpPost httpPost = new HttpPost("http://localhost:12345/dolphinscheduler/projects/create"); - httpPost.setHeader("token", "123"); - // set parameters - List parameters = new ArrayList(); - parameters.add(new BasicNameValuePair("projectName", "qzw")); - parameters.add(new BasicNameValuePair("desc", "qzw")); - - UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(parameters); - httpPost.setEntity(formEntity); - - - CloseableHttpResponse response = null; - try { - // execute - response = httpclient.execute(httpPost); - // response status code 200 - if (response.getStatusLine().getStatusCode() == 200) { - String content = EntityUtils.toString(response.getEntity(), "UTF-8"); - logger.info(content); - } - } finally { - if (response != null) { - response.close(); - } - httpclient.close(); - } - } - - /** - * do get param path variables chinese - * @throws Exception - */ - @Test - public void doGETParamPathVariableAndChinese()throws Exception{ - // create HttpClient - CloseableHttpClient httpclient = HttpClients.createDefault(); - - List parameters = new ArrayList(); - // parameters.add(new BasicNameValuePair("pageSize", "10")); - - // define the parameters of the request - URI uri = new URIBuilder("http://localhost:12345/dolphinscheduler/projects/%E5%85%A8%E9%83%A8%E6%B5%81%E7%A8%8B%E6%B5%8B%E8%AF%95/process/list") - .build(); - - // create http GET request - HttpGet httpGet = new HttpGet(uri); - httpGet.setHeader("token","10f5625a2a1cbf9aa710653796c5d764"); - //response object - CloseableHttpResponse response = null; - try { - // execute http get request - response = httpclient.execute(httpGet); - // response status code 200 - if (response.getStatusLine().getStatusCode() == 200) { - String content = EntityUtils.toString(response.getEntity(), "UTF-8"); - logger.info("start--------------->"); - logger.info(content); - logger.info("end----------------->"); - } - } finally { - if (response != null) { - response.close(); - } - httpclient.close(); - } - } - - /** - * - * do get param - * @throws Exception - */ - @Test - public void doGETParam()throws Exception{ - // create HttpClient - CloseableHttpClient httpclient = HttpClients.createDefault(); - - List parameters = new ArrayList(); - parameters.add(new BasicNameValuePair("startDate", "2018-04-22 19:30:08")); - parameters.add(new BasicNameValuePair("endDate", "2028-04-22 19:30:08")); - parameters.add(new BasicNameValuePair("projectId", "0")); - - // define the parameters of the request - URI uri = new URIBuilder("http://localhost:12345/dolphinscheduler/projects/analysis/queue-count") - .setParameters(parameters) - .build(); - - // create http GET request - HttpGet httpGet = new HttpGet(uri); - httpGet.setHeader("token","2aef24c052c212fab9eec78848c2258b"); - //response object - CloseableHttpResponse response = null; - try { - // execute http get request - response = httpclient.execute(httpGet); - // response status code 200 - if (response.getStatusLine().getStatusCode() == 200) { - String content = EntityUtils.toString(response.getEntity(), "UTF-8"); - logger.info("start--------------->"); - logger.info(content); - logger.info("end----------------->"); - } - } finally { - if (response != null) { - response.close(); - } - httpclient.close(); - } - } - -} diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AbstractControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AbstractControllerTest.java index dcc9da32dc..867f34261b 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AbstractControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AbstractControllerTest.java @@ -20,22 +20,30 @@ package org.apache.dolphinscheduler.api.controller; import org.apache.dolphinscheduler.api.ApiApplicationServer; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.SessionService; +import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.UserType; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.commons.lang.StringUtils; +import org.apache.curator.test.TestingServer; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; +import javax.annotation.PostConstruct; + import org.junit.After; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -44,8 +52,10 @@ import org.springframework.web.context.WebApplicationContext; /** * abstract controller test */ +@ActiveProfiles(value = {ProfileType.H2}) @RunWith(SpringRunner.class) @SpringBootTest(classes = ApiApplicationServer.class) +@Ignore public class AbstractControllerTest { public static final String SESSION_ID = "sessionId"; @@ -58,6 +68,9 @@ public class AbstractControllerTest { @Autowired private SessionService sessionService; + @Autowired + private UsersService usersService; + protected User user; protected String sessionId; @@ -66,7 +79,8 @@ public class AbstractControllerTest { public void setUp() { mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - createSession(); + user = usersService.queryUser(1); + createSession(user); } @After @@ -74,11 +88,7 @@ public class AbstractControllerTest { sessionService.signOut("127.0.0.1", user); } - private void createSession() { - - User loginUser = new User(); - loginUser.setId(1); - loginUser.setUserType(UserType.GENERAL_USER); + private void createSession(User loginUser) { user = loginUser; @@ -102,4 +112,14 @@ public class AbstractControllerTest { result.put(Constants.MSG, status.getMsg()); } } + + @Configuration + @Profile(ProfileType.H2) + public static class RegistryServer { + @PostConstruct + public void startEmbedRegistryServer() throws Exception { + final TestingServer server = new TestingServer(true); + System.setProperty("registry.servers", server.getConnectString()); + } + } } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java index e7863739de..f412ee6e90 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java @@ -24,8 +24,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; import java.util.HashMap; diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/EnvironmentControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/EnvironmentControllerTest.java index 0b7233be92..98426346c2 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/EnvironmentControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/EnvironmentControllerTest.java @@ -40,12 +40,8 @@ import org.springframework.util.MultiValueMap; import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.base.Preconditions; -/** - * environment controller test - */ public class EnvironmentControllerTest extends AbstractControllerTest { - - private static Logger logger = LoggerFactory.getLogger(EnvironmentControllerTest.class); + private static final Logger logger = LoggerFactory.getLogger(EnvironmentControllerTest.class); private String environmentCode; @@ -60,6 +56,7 @@ public class EnvironmentControllerTest extends AbstractControllerTest { testCreateEnvironment(); } + @Override @After public void after() throws Exception { testDeleteEnvironment(); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~dev b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~dev deleted file mode 100644 index a96cec9158..0000000000 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~dev +++ /dev/null @@ -1,45 +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.dolphinscheduler.api.security; - -import org.apache.dolphinscheduler.api.ApiApplicationServer; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ApiApplicationServer.class) -@TestPropertySource(properties = { - "security.authentication.type=LDAP", -}) -public class SecurityConfigLDAPTest { - - @Autowired - private SecurityConfig securityConfig; - - @Test - public void testAuthenticator() { - Authenticator authenticator = securityConfig.authenticator(); - Assert.assertNotNull(authenticator); - } -} diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticatorTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticatorTest.java index 9b6814815c..9fa7aa2c14 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticatorTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapAuthenticatorTest.java @@ -79,6 +79,7 @@ public class LdapAuthenticatorTest extends AbstractControllerTest { private String ip = "127.0.0.1"; private UserType userType = UserType.GENERAL_USER; + @Override @Before public void setUp() { ldapAuthenticator = new LdapAuthenticator(); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapServiceTest.java index 8cd435f954..4cfdb0e50a 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/ldap/LdapServiceTest.java @@ -18,18 +18,23 @@ package org.apache.dolphinscheduler.api.security.impl.ldap; import org.apache.dolphinscheduler.api.ApiApplicationServer; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.apache.dolphinscheduler.common.enums.UserType; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; +@Ignore +@ActiveProfiles(ProfileType.H2) @RunWith(SpringRunner.class) @SpringBootTest(classes = ApiApplicationServer.class) @TestPropertySource( @@ -78,4 +83,4 @@ public class LdapServiceTest { String email2 = ldapService.ldapLogin("tesla", "error password"); Assert.assertNull(email2); } -} \ No newline at end of file +} diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/pwd/PasswordAuthenticatorTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/pwd/PasswordAuthenticatorTest.java index 2ccc802ecf..b58a4b59df 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/pwd/PasswordAuthenticatorTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/impl/pwd/PasswordAuthenticatorTest.java @@ -57,6 +57,7 @@ public class PasswordAuthenticatorTest extends AbstractControllerTest { private User mockUser; private Session mockSession; + @Override @Before public void setUp() { authenticator = new PasswordAuthenticator(); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java index f115370415..292bf71aaf 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java @@ -17,11 +17,6 @@ package org.apache.dolphinscheduler.api.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; - import org.apache.dolphinscheduler.api.dto.CommandStateCount; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.DataAnalysisServiceImpl; @@ -30,26 +25,9 @@ import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; -import org.apache.dolphinscheduler.dao.entity.CommandCount; -import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; -import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount; -import org.apache.dolphinscheduler.dao.entity.Project; -import org.apache.dolphinscheduler.dao.entity.User; -import org.apache.dolphinscheduler.dao.mapper.CommandMapper; -import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper; -import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; -import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; -import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; -import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; +import org.apache.dolphinscheduler.dao.entity.*; +import org.apache.dolphinscheduler.dao.mapper.*; import org.apache.dolphinscheduler.service.process.ProcessService; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -61,6 +39,12 @@ import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.modules.junit4.PowerMockRunner; +import java.text.MessageFormat; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.*; + /** * data analysis service test */ @@ -190,10 +174,10 @@ public class DataAnalysisServiceTest { Mockito.when(taskInstanceMapper.countTaskInstanceStateByUser(any(), any(), any())).thenReturn( Collections.emptyList()); result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, null, null); - assertThat(result.get(Constants.DATA_LIST)).extracting("totalCount").first().isEqualTo(0); - assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").first().asList().hasSameSizeAs( + assertThat(result.get(Constants.DATA_LIST)).extracting("totalCount").isEqualTo(0); + assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").asList().hasSameSizeAs( ExecutionStatus.values()); - assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").first().asList().extracting( + assertThat(result.get(Constants.DATA_LIST)).extracting("taskCountDtos").asList().extracting( "count").allMatch(count -> count.equals(0)); } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java index 022ea24db2..d29b6be8a8 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java @@ -21,22 +21,24 @@ import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.DataSourceServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.datasource.DatasourceUtil; -import org.apache.dolphinscheduler.common.datasource.hive.HiveDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.oracle.OracleDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.postgresql.PostgreSqlDatasourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbConnectType; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.UserType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; -import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbConnectType; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import java.sql.Connection; import java.util.ArrayList; @@ -60,7 +62,7 @@ import org.powermock.modules.junit4.PowerMockRunner; */ @RunWith(PowerMockRunner.class) @PowerMockIgnore({"sun.security.*", "javax.net.*"}) -@PrepareForTest({DatasourceUtil.class, CommonUtils.class}) +@PrepareForTest({DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class DataSourceServiceTest { @InjectMocks @@ -307,13 +309,14 @@ public class DataSourceServiceTest { oracleDatasourceParamDTO.setConnectType(DbConnectType.ORACLE_SERVICE_NAME); ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(oracleDatasourceParamDTO); - String expected = "{\"user\":\"test\",\"password\":\"test\",\"address\":\"jdbc:oracle:thin:@//192.168.9.1:1521\"," - + "\"database\":\"im\",\"jdbcUrl\":\"jdbc:oracle:thin:@//192.168.9.1:1521/im\",\"connectType\":\"ORACLE_SERVICE_NAME\"}"; + String expected = "{\"user\":\"test\",\"password\":\"test\",\"address\":\"jdbc:oracle:thin:@//192.168.9.1:1521\",\"database\":\"im\",\"jdbcUrl\":\"jdbc:oracle:thin:@//192.168.9.1:1521/im\"," + + "\"driverClassName\":\"oracle.jdbc.OracleDriver\",\"validationQuery\":\"select 1 from dual\",\"connectType\":\"ORACLE_SERVICE_NAME\"}"; Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam)); PowerMockito.mockStatic(CommonUtils.class); + PowerMockito.mockStatic(PasswordUtils.class); PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(true); - PowerMockito.when(CommonUtils.encodePassword(Mockito.anyString())).thenReturn("test"); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); HiveDataSourceParamDTO hiveDataSourceParamDTO = new HiveDataSourceParamDTO(); hiveDataSourceParamDTO.setHost("192.168.9.1"); hiveDataSourceParamDTO.setPort(10000); @@ -325,8 +328,8 @@ public class DataSourceServiceTest { hiveDataSourceParamDTO.setLoginUserKeytabPath("/opt/hdfs.headless.keytab"); hiveDataSourceParamDTO.setLoginUserKeytabUsername("test2/hdfs-mycluster@ESZ.COM"); connectionParam = DatasourceUtil.buildConnectionParams(hiveDataSourceParamDTO); - expected = "{\"user\":\"test\",\"password\":\"test\",\"address\":\"jdbc:hive2://192.168.9.1:10000\"," - + "\"database\":\"im\",\"jdbcUrl\":\"jdbc:hive2://192.168.9.1:10000/im;principal=hive/hdfs-mycluster@ESZ.COM\",\"principal\":\"hive/hdfs-mycluster@ESZ.COM\"," + expected = "{\"user\":\"test\",\"password\":\"test\",\"address\":\"jdbc:hive2://192.168.9.1:10000\",\"database\":\"im\",\"jdbcUrl\":\"jdbc:hive2://192.168.9.1:10000/im;" + + "principal=hive/hdfs-mycluster@ESZ.COM\",\"driverClassName\":\"org.apache.hive.jdbc.HiveDriver\",\"validationQuery\":\"select 1\",\"principal\":\"hive/hdfs-mycluster@ESZ.COM\"," + "\"javaSecurityKrb5Conf\":\"/opt/krb5.conf\",\"loginUserKeytabUsername\":\"test2/hdfs-mycluster@ESZ.COM\",\"loginUserKeytabPath\":\"/opt/hdfs.headless.keytab\"}"; Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam)); @@ -346,8 +349,8 @@ public class DataSourceServiceTest { mysqlDatasourceParamDTO.setPassword("123456"); mysqlDatasourceParamDTO.setOther(other); ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(mysqlDatasourceParamDTO); - String expected = "{\"user\":\"test\",\"password\":\"IUAjJCVeJipNVEl6TkRVMg==\",\"address\":\"jdbc:mysql://192.168.9.1:1521\"," - + "\"database\":\"im\",\"jdbcUrl\":\"jdbc:mysql://192.168.9.1:1521/im\"}"; + String expected = "{\"user\":\"test\",\"password\":\"IUAjJCVeJipNVEl6TkRVMg==\",\"address\":\"jdbc:mysql://192.168.9.1:1521\",\"database\":\"im\",\"jdbcUrl\":\"jdbc:mysql://192.168.9.1:1521/" + + "im\",\"driverClassName\":\"com.mysql.jdbc.Driver\",\"validationQuery\":\"select 1\",\"props\":{\"autoDeserialize\":\"yes\",\"allowUrlInLocalInfile\":\"true\"}}"; Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam)); PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "false"); @@ -358,8 +361,8 @@ public class DataSourceServiceTest { mysqlDatasourceParamDTO.setUserName("test"); mysqlDatasourceParamDTO.setPassword("123456"); connectionParam = DatasourceUtil.buildConnectionParams(mysqlDatasourceParamDTO); - expected = "{\"user\":\"test\",\"password\":\"123456\",\"address\":\"jdbc:mysql://192.168.9.1:1521\"," - + "\"database\":\"im\",\"jdbcUrl\":\"jdbc:mysql://192.168.9.1:1521/im\"}"; + expected = "{\"user\":\"test\",\"password\":\"123456\",\"address\":\"jdbc:mysql://192.168.9.1:1521\",\"database\":\"im\"," + + "\"jdbcUrl\":\"jdbc:mysql://192.168.9.1:1521/im\",\"driverClassName\":\"com.mysql.jdbc.Driver\",\"validationQuery\":\"select 1\"}"; Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam)); } @@ -396,12 +399,15 @@ public class DataSourceServiceTest { ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(postgreSqlDatasourceParam); PowerMockito.mockStatic(DatasourceUtil.class); + PowerMockito.mockStatic(DataSourceClientProvider.class); + DataSourceClientProvider clientProvider = PowerMockito.mock(DataSourceClientProvider.class); + PowerMockito.when(DataSourceClientProvider.getInstance()).thenReturn(clientProvider); Result result = dataSourceService.checkConnection(dataSourceType, connectionParam); Assert.assertEquals(Status.CONNECTION_TEST_FAILURE.getCode(), result.getCode().intValue()); Connection connection = PowerMockito.mock(Connection.class); - PowerMockito.when(DatasourceUtil.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection); + PowerMockito.when(clientProvider.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection); result = dataSourceService.checkConnection(dataSourceType, connectionParam); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/MonitorServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/MonitorServiceTest.java index 50e0849ad8..344ea8968e 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/MonitorServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/MonitorServiceTest.java @@ -20,10 +20,10 @@ package org.apache.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.MonitorServiceImpl; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.dao.MonitorDBDao; import org.apache.dolphinscheduler.dao.entity.MonitorRecord; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.collections.CollectionUtils; diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml index ec114edb99..f8600e3789 100644 --- a/dolphinscheduler-common/pom.xml +++ b/dolphinscheduler-common/pom.xml @@ -27,10 +27,6 @@ dolphinscheduler-common jar - - UTF-8 - 3.1.0 - @@ -42,14 +38,6 @@ org.apache.httpcomponents httpclient - - io.airlift.resolver - resolver - - - org.sonatype.aether - aether-api - org.ow2.asm asm @@ -66,16 +54,9 @@ - - - junit - junit - test - org.mockito mockito-core - jar test @@ -89,19 +70,6 @@ org.powermock powermock-api-mockito2 test - - - org.mockito - mockito-core - - - - - - org.jacoco - org.jacoco.agent - runtime - test @@ -624,11 +592,6 @@ compile - - org.codehaus.janino - janino - ${codehaus.janino.version} - com.github.rholder guava-retrying @@ -646,7 +609,6 @@ io.netty netty-all - compile diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index bebfa2902d..56494d3640 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -467,39 +467,37 @@ public final class Constants { public static final String SPRING_DATASOURCE_PASSWORD = "spring.datasource.password"; - public static final String SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT = "spring.datasource.validationQueryTimeout"; - - public static final String SPRING_DATASOURCE_INITIAL_SIZE = "spring.datasource.initialSize"; + public static final String SPRING_DATASOURCE_CONNECTION_TIMEOUT = "spring.datasource.connectionTimeout"; public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle"; public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive"; - public static final String SPRING_DATASOURCE_MAX_WAIT = "spring.datasource.maxWait"; - - public static final String SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS = "spring.datasource.timeBetweenEvictionRunsMillis"; + public static final String SPRING_DATASOURCE_IDLE_TIMEOUT = "spring.datasource.idleTimeout"; - public static final String SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS = "spring.datasource.timeBetweenConnectErrorMillis"; + public static final String SPRING_DATASOURCE_MAX_LIFE_TIME = "spring.datasource.maxLifetime"; - public static final String SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS = "spring.datasource.minEvictableIdleTimeMillis"; + public static final String SPRING_DATASOURCE_VALIDATION_TIMEOUT = "spring.datasource.validationTimeout"; public static final String SPRING_DATASOURCE_VALIDATION_QUERY = "spring.datasource.validationQuery"; - public static final String SPRING_DATASOURCE_TEST_WHILE_IDLE = "spring.datasource.testWhileIdle"; + public static final String SPRING_DATASOURCE_LEAK_DETECTION_THRESHOLD = "spring.datasource.leakDetectionThreshold"; - public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow"; + public static final String SPRING_DATASOURCE_INITIALIZATION_FAIL_TIMEOUT = "spring.datasource.initializationFailTimeout"; - public static final String SPRING_DATASOURCE_TEST_ON_RETURN = "spring.datasource.testOnReturn"; + public static final String SPRING_DATASOURCE_IS_AUTOCOMMIT = "spring.datasource.isAutoCommit"; - public static final String SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS = "spring.datasource.poolPreparedStatements"; + public static final String SPRING_DATASOURCE_CACHE_PREP_STMTS = "spring.datasource.cachePrepStmts"; - public static final String SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT = "spring.datasource.defaultAutoCommit"; + public static final String SPRING_DATASOURCE_PREP_STMT_CACHE_SIZE = "spring.datasource.prepStmtCacheSize"; - public static final String SPRING_DATASOURCE_KEEP_ALIVE = "spring.datasource.keepAlive"; + public static final String SPRING_DATASOURCE_PREP_STMT_CACHE_SQL_LIMIT = "spring.datasource.prepStmtCacheSqlLimit"; - public static final String SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE = "spring.datasource.maxPoolPreparedStatementPerConnectionSize"; + public static final String CACHE_PREP_STMTS = "cachePrepStmts"; - public static final String DEVELOPMENT = "development"; + public static final String PREP_STMT_CACHE_SIZE = "prepStmtCacheSize"; + + public static final String PREP_STMT_CACHE_SQL_LIMIT = "prepStmtCacheSqlLimit"; public static final String QUARTZ_PROPERTIES_PATH = "quartz.properties"; @@ -948,6 +946,19 @@ public final class Constants { public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver"; public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; + + /** + * validation Query + */ + public static final String POSTGRESQL_VALIDATION_QUERY = "select version()"; + public static final String MYSQL_VALIDATION_QUERY = "select 1"; + public static final String HIVE_VALIDATION_QUERY = "select 1"; + public static final String CLICKHOUSE_VALIDATION_QUERY = "select 1"; + public static final String ORACLE_VALIDATION_QUERY = "select 1 from dual"; + public static final String SQLSERVER_VALIDATION_QUERY = "select 1"; + public static final String DB2_VALIDATION_QUERY = "select 1 from sysibm.sysdummy1"; + public static final String PRESTO_VALIDATION_QUERY = "select 1"; + /** * database type */ @@ -1022,12 +1033,6 @@ public final class Constants { */ public static final int AUTHORIZE_READABLE_PERM = 4; - - /** - * plugin configurations - */ - public static final String PLUGIN_JAR_SUFFIX = ".jar"; - public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1; public static final int BUSY_NODE_STATUE = 2; @@ -1041,9 +1046,6 @@ public final class Constants { */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); - - public static final String EXCEL_SUFFIX_XLS = ".xls"; - /** * datasource encryption salt */ @@ -1080,21 +1082,7 @@ public final class Constants { * docker & kubernetes */ public static final boolean DOCKER_MODE = !StringUtils.isEmpty(System.getenv("DOCKER")); - public static final boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); - - /** - * task parameter keys - */ - public static final String TASK_PARAMS = "params"; - public static final String TASK_PARAMS_DATASOURCE = "datasource"; - public static final String TASK_PARAMS_DATASOURCE_NAME = "datasourceName"; - public static final String TASK_DEPENDENCE = "dependence"; - public static final String TASK_DEPENDENCE_DEPEND_TASK_LIST = "dependTaskList"; - public static final String TASK_DEPENDENCE_DEPEND_ITEM_LIST = "dependItemList"; - public static final String TASK_DEPENDENCE_PROJECT_ID = "projectId"; - public static final String TASK_DEPENDENCE_PROJECT_NAME = "projectName"; - public static final String TASK_DEPENDENCE_DEFINITION_ID = "definitionId"; - public static final String TASK_DEPENDENCE_DEFINITION_NAME = "definitionName"; + public static final Boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); /** * dry run flag diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsDatasourceParamDTO.java deleted file mode 100644 index 747d3ea274..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsDatasourceParamDTO.java +++ /dev/null @@ -1,61 +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.dolphinscheduler.common.datasource; - -public abstract class BaseHdfsDatasourceParamDTO extends BaseDataSourceParamDTO { - - protected String principal; - - protected String javaSecurityKrb5Conf; - - protected String loginUserKeytabUsername; - - protected String loginUserKeytabPath; - - public String getPrincipal() { - return principal; - } - - public void setPrincipal(String principal) { - this.principal = principal; - } - - public String getLoginUserKeytabUsername() { - return loginUserKeytabUsername; - } - - public void setLoginUserKeytabUsername(String loginUserKeytabUsername) { - this.loginUserKeytabUsername = loginUserKeytabUsername; - } - - public String getLoginUserKeytabPath() { - return loginUserKeytabPath; - } - - public void setLoginUserKeytabPath(String loginUserKeytabPath) { - this.loginUserKeytabPath = loginUserKeytabPath; - } - - public String getJavaSecurityKrb5Conf() { - return javaSecurityKrb5Conf; - } - - public void setJavaSecurityKrb5Conf(String javaSecurityKrb5Conf) { - this.javaSecurityKrb5Conf = javaSecurityKrb5Conf; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceProcessor.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceProcessor.java deleted file mode 100644 index e76a088001..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceProcessor.java +++ /dev/null @@ -1,81 +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.dolphinscheduler.common.datasource; - -import org.apache.dolphinscheduler.common.enums.DbType; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.SQLException; - -public interface DatasourceProcessor { - - /** - * check datasource param is valid - */ - void checkDatasourceParam(BaseDataSourceParamDTO datasourceParam); - - /** - * create BaseDataSourceParamDTO by connectionJson - * - * @param connectionJson see{@link org.apache.dolphinscheduler.dao.entity.Datasource} - * @return {@link BaseDataSourceParamDTO} - */ - BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson); - - /** - * create datasource connection parameter which will be stored at DataSource - *

- * see {@code org.apache.dolphinscheduler.dao.entity.DataSource.connectionParams} - */ - ConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam); - - /** - * deserialize json to datasource connection param - * - * @param connectionJson {@code org.apache.dolphinscheduler.dao.entity.DataSource.connectionParams} - * @return {@link BaseConnectionParam} - */ - ConnectionParam createConnectionParams(String connectionJson); - - /** - * get datasource Driver - */ - String getDatasourceDriver(); - - /** - * get jdbcUrl by connection param, the jdbcUrl is different with ConnectionParam.jdbcUrl, this method will inject - * other to jdbcUrl - * - * @param connectionParam connection param - */ - String getJdbcUrl(ConnectionParam connectionParam); - - /** - * get connection by connectionParam - * - * @param connectionParam connectionParam - * @return {@link Connection} - */ - Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException, IOException; - - /** - * @return {@link DbType} - */ - DbType getDbType(); -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceParamDTO.java deleted file mode 100644 index f4168fce5f..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceParamDTO.java +++ /dev/null @@ -1,41 +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.dolphinscheduler.common.datasource.clickhouse; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class ClickHouseDatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "ClickHouseDatasourceParamDTO{" - + "host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.CLICKHOUSE; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceParamDTO.java deleted file mode 100644 index c989472832..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceParamDTO.java +++ /dev/null @@ -1,43 +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.dolphinscheduler.common.datasource.db2; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class Db2DatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "Db2DatasourceParamDTO{" - + "name='" + name + '\'' - + ", note='" + note + '\'' - + ", host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.DB2; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveConnectionParam.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveConnectionParam.java deleted file mode 100644 index e982211df7..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveConnectionParam.java +++ /dev/null @@ -1,38 +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.dolphinscheduler.common.datasource.hive; - -import org.apache.dolphinscheduler.common.datasource.BaseHdfsConnectionParam; - -public class HiveConnectionParam extends BaseHdfsConnectionParam { - @Override - public String toString() { - return "HiveConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + ", principal='" + principal + '\'' - + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' - + ", loginUserKeytabUsername='" + loginUserKeytabUsername + '\'' - + ", loginUserKeytabPath='" + loginUserKeytabPath + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDataSourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDataSourceParamDTO.java deleted file mode 100644 index 816d08889a..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDataSourceParamDTO.java +++ /dev/null @@ -1,45 +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.dolphinscheduler.common.datasource.hive; - -import org.apache.dolphinscheduler.common.datasource.BaseHdfsDatasourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class HiveDataSourceParamDTO extends BaseHdfsDatasourceParamDTO { - - @Override - public String toString() { - return "HiveDataSourceParamDTO{" - + "host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", principal='" + principal + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' - + ", loginUserKeytabUsername='" + loginUserKeytabUsername + '\'' - + ", loginUserKeytabPath='" + loginUserKeytabPath + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.HIVE; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlConnectionParam.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlConnectionParam.java deleted file mode 100644 index 3c5117c2e2..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.common.datasource.mysql; - -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; - -public class MysqlConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "MysqlConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceParamDTO.java deleted file mode 100644 index 3e8f0ed918..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceParamDTO.java +++ /dev/null @@ -1,43 +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.dolphinscheduler.common.datasource.mysql; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class MysqlDatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "MysqlDatasourceParamDTO{" - + "name='" + name + '\'' - + ", note='" + note + '\'' - + ", host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.MYSQL; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleConnectionParam.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleConnectionParam.java deleted file mode 100644 index a59f50badb..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleConnectionParam.java +++ /dev/null @@ -1,46 +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.dolphinscheduler.common.datasource.oracle; - -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbConnectType; - -public class OracleConnectionParam extends BaseConnectionParam { - protected DbConnectType connectType; - - public DbConnectType getConnectType() { - return connectType; - } - - public void setConnectType(DbConnectType connectType) { - this.connectType = connectType; - } - - @Override - public String toString() { - return "OracleConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + ", connectType=" + connectType - + '}'; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceParamDTO.java deleted file mode 100644 index 615c514074..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceParamDTO.java +++ /dev/null @@ -1,55 +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.dolphinscheduler.common.datasource.oracle; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbConnectType; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class OracleDatasourceParamDTO extends BaseDataSourceParamDTO { - - private DbConnectType connectType; - - public DbConnectType getConnectType() { - return connectType; - } - - public void setConnectType(DbConnectType connectType) { - this.connectType = connectType; - } - - @Override - public String toString() { - return "OracleDatasourceParamDTO{" - + "name='" + name + '\'' - + ", note='" + note + '\'' - + ", host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", connectType=" + connectType - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.ORACLE; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceParamDTO.java deleted file mode 100644 index 5d81233a7a..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceParamDTO.java +++ /dev/null @@ -1,41 +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.dolphinscheduler.common.datasource.postgresql; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class PostgreSqlDatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "PostgreSqlDatasourceParamDTO{" - + "host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.POSTGRESQL; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceParamDTO.java deleted file mode 100644 index 9477362b03..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceParamDTO.java +++ /dev/null @@ -1,43 +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.dolphinscheduler.common.datasource.presto; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class PrestoDatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "PrestoDatasourceParamDTO{" - + "name='" + name + '\'' - + ", note='" + note + '\'' - + ", host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.PRESTO; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceParamDTO.java deleted file mode 100644 index 784f7d01d9..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceParamDTO.java +++ /dev/null @@ -1,45 +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.dolphinscheduler.common.datasource.spark; - -import org.apache.dolphinscheduler.common.datasource.BaseHdfsDatasourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class SparkDatasourceParamDTO extends BaseHdfsDatasourceParamDTO { - - @Override - public String toString() { - return "SparkDatasourceParamDTO{" - + "host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", principal='" + principal + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' - + ", loginUserKeytabUsername='" + loginUserKeytabUsername + '\'' - + ", loginUserKeytabPath='" + loginUserKeytabPath + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.SPARK; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceParamDTO.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceParamDTO.java deleted file mode 100644 index 62c757638f..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceParamDTO.java +++ /dev/null @@ -1,43 +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.dolphinscheduler.common.datasource.sqlserver; - -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; - -public class SqlServerDatasourceParamDTO extends BaseDataSourceParamDTO { - - @Override - public String toString() { - return "SqlServerDatasourceParamDTO{" - + "name='" + name + '\'' - + ", note='" + note + '\'' - + ", host='" + host + '\'' - + ", port=" + port - + ", database='" + database + '\'' - + ", userName='" + userName + '\'' - + ", password='" + password + '\'' - + ", other='" + other + '\'' - + '}'; - } - - @Override - public DbType getType() { - return DbType.SQLSERVER; - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/DbType.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/DbType.java deleted file mode 100644 index b994afb5f5..0000000000 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/DbType.java +++ /dev/null @@ -1,60 +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.dolphinscheduler.common.enums; - -import static java.util.stream.Collectors.toMap; - -import java.util.Arrays; -import java.util.Map; - -import com.baomidou.mybatisplus.annotation.EnumValue; -import com.google.common.base.Functions; - -public enum DbType { - MYSQL(0), - POSTGRESQL(1), - HIVE(2), - SPARK(3), - CLICKHOUSE(4), - ORACLE(5), - SQLSERVER(6), - DB2(7), - PRESTO(8), - H2(9); - - DbType(int code) { - this.code = code; - } - - @EnumValue - private final int code; - - public int getCode() { - return code; - } - - private static final Map DB_TYPE_MAP = - Arrays.stream(DbType.values()).collect(toMap(DbType::getCode, Functions.identity())); - - public static DbType of(int type) { - if (DB_TYPE_MAP.containsKey(type)) { - return DB_TYPE_MAP.get(type); - } - return null; - } -} diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDaoTest.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ProfileType.java similarity index 66% rename from dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDaoTest.java rename to dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ProfileType.java index 4561cabaee..42144ba90d 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDaoTest.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ProfileType.java @@ -14,16 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dolphinscheduler.dao.upgrade; -import org.junit.Test; +package org.apache.dolphinscheduler.common.enums; -public class UpgradeDaoTest { - PostgresqlUpgradeDao postgresqlUpgradeDao = PostgresqlUpgradeDao.getInstance(); +import com.google.common.collect.Lists; - @Test - public void testQueryQueryAllOldWorkerGroup() throws Exception{ - //postgresqlUpgradeDao.updateProcessDefinitionJsonWorkerGroup(); - } +import java.util.List; +public enum ProfileType { + ; + + public static final String H2 = "h2"; + + public static final String MYSQL = "mysql"; + + public static final String POSTGRESQL = "postgresql"; + + public static final List DATASOURCE_PROFILE = Lists.newArrayList(H2, MYSQL, POSTGRESQL); } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java index 0933832632..ffed1d13f4 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java @@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.ResUploadType; +import org.apache.dolphinscheduler.spi.enums.ResUploadType; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java index 53a97d9755..96519d4249 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java @@ -20,7 +20,7 @@ package org.apache.dolphinscheduler.common.utils; import static org.apache.dolphinscheduler.common.Constants.COMMON_PROPERTIES_PATH; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.ResUploadType; +import org.apache.dolphinscheduler.spi.enums.ResUploadType; import org.apache.directory.api.util.Strings; @@ -179,58 +179,6 @@ public class PropertyUtils { return val == null ? defaultVal : Long.parseLong(val); } - /** - * @param key key - * @return property value - */ - public static long getLong(String key) { - return getLong(key, -1); - } - - /** - * @param key key - * @param defaultVal default value - * @return property value - */ - public static double getDouble(String key, double defaultVal) { - String val = getString(key); - return val == null ? defaultVal : Double.parseDouble(val); - } - - /** - * get array - * - * @param key property name - * @param splitStr separator - * @return property value through array - */ - public static String[] getArray(String key, String splitStr) { - String value = getString(key); - if (value == null) { - return new String[0]; - } - try { - String[] propertyArray = value.split(splitStr); - return propertyArray; - } catch (NumberFormatException e) { - logger.info(e.getMessage(), e); - } - return new String[0]; - } - - /** - * @param key key - * @param type type - * @param defaultValue default value - * @param T - * @return get enum value - */ - public static > T getEnum(String key, Class type, - T defaultValue) { - String val = getString(key); - return val == null ? defaultValue : Enum.valueOf(type, val); - } - /** * get all properties with specified prefix, like: fs. * @@ -247,9 +195,6 @@ public class PropertyUtils { return matchedProperties; } - /** - * - */ public static void setValue(String key, String value) { properties.setProperty(key, value); } diff --git a/dolphinscheduler-common/src/main/resources/common.properties b/dolphinscheduler-common/src/main/resources/common.properties index 4005a0afaf..3cf79f3783 100644 --- a/dolphinscheduler-common/src/main/resources/common.properties +++ b/dolphinscheduler-common/src/main/resources/common.properties @@ -89,3 +89,6 @@ sudo.enable=true # development state development.state=false + +#datasource.plugin.dir config +datasource.plugin.dir=lib/plugin/datasource diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/CommonTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/CommonTest.java deleted file mode 100644 index 3752fe670c..0000000000 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/CommonTest.java +++ /dev/null @@ -1,46 +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.dolphinscheduler.common; - -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -import org.junit.Test; - -/** - * CommonTest - */ -public class CommonTest { - - public static void setFinalStatic(Field field, Object newValue) throws NoSuchFieldException, IllegalAccessException { - field.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.set(null, newValue); - } - - @Test - public void testSetFinalStatic() throws Exception { - setFinalStatic(Constants.class.getDeclaredField("KUBERNETES_MODE"), true); - assertTrue(Constants.KUBERNETES_MODE); - } - -} diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java index 9879154889..11c114c29e 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/threadutils/ThreadPoolExecutorsTest.java @@ -25,13 +25,10 @@ import org.slf4j.LoggerFactory; * Thread Pool Executor Test */ public class ThreadPoolExecutorsTest { - private static final Logger logger = LoggerFactory.getLogger(ThreadPoolExecutors.class); - @Test public void testThreadPoolExecutors() throws InterruptedException { - Thread2[] threadArr = new Thread2[10]; for (int i = 0; i < threadArr.length; i++) { @@ -43,14 +40,10 @@ public class ThreadPoolExecutorsTest { Thread.currentThread().join(40000l); } - - //test thread - class Thread2 extends Thread { + static class Thread2 extends Thread { @Override public void run() { logger.info("ThreadPoolExecutors instance's hashcode is: {} ",ThreadPoolExecutors.getInstance("a",2).hashCode()); } } - - } diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java index 92f0d7bd49..713709030f 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java @@ -17,9 +17,8 @@ package org.apache.dolphinscheduler.common.utils; -import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; -import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; import java.net.InetAddress; @@ -28,7 +27,6 @@ import java.net.UnknownHostException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; @@ -53,41 +51,6 @@ public class CommonUtilsTest { Assert.assertTrue(true); } - @Test - public void getKerberosStartupState() { - boolean kerberosStartupState = CommonUtils.getKerberosStartupState(); - logger.info("kerberos startup state: {}",kerberosStartupState); - Assert.assertFalse(kerberosStartupState); - PowerMockito.mockStatic(PropertyUtils.class); - PowerMockito.when(PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE)).thenReturn("HDFS"); - PowerMockito.when(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)).thenReturn(Boolean.TRUE); - kerberosStartupState = CommonUtils.getKerberosStartupState(); - logger.info("kerberos startup state: {}",kerberosStartupState); - Assert.assertTrue(kerberosStartupState); - - } - - @Test - public void loadKerberosConf() { - try { - PowerMockito.mockStatic(PropertyUtils.class); - PowerMockito.when(PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE)).thenReturn("HDFS"); - PowerMockito.when(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)).thenReturn(Boolean.TRUE); - PowerMockito.when(PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH)).thenReturn("/opt/krb5.conf"); - PowerMockito.when(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME)).thenReturn("hdfs-mycluster@ESZ.COM"); - PowerMockito.when(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH)).thenReturn("/opt/hdfs.headless.keytab"); - - PowerMockito.mockStatic(UserGroupInformation.class); - boolean result = CommonUtils.loadKerberosConf(new Configuration()); - Assert.assertTrue(result); - - CommonUtils.loadKerberosConf(null, null, null); - - } catch (Exception e) { - Assert.fail("load Kerberos Conf failed"); - } - } - @Test public void getHdfsDataBasePath() { logger.info(HadoopUtils.getHdfsDataBasePath()); @@ -124,41 +87,4 @@ public class CommonUtilsTest { Assert.assertTrue(true); } - @Test - public void encodePassword() { - - PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE,"true"); - - Assert.assertEquals("",CommonUtils.encodePassword("")); - Assert.assertEquals("IUAjJCVeJipNVEl6TkRVMg==",CommonUtils.encodePassword("123456")); - Assert.assertEquals("IUAjJCVeJipJVkZCV2xoVFYwQT0=",CommonUtils.encodePassword("!QAZXSW@")); - Assert.assertEquals("IUAjJCVeJipOV1JtWjJWeUtFQT0=",CommonUtils.encodePassword("5dfger(@")); - - PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE,"false"); - - Assert.assertEquals("",CommonUtils.encodePassword("")); - Assert.assertEquals("123456",CommonUtils.encodePassword("123456")); - Assert.assertEquals("!QAZXSW@",CommonUtils.encodePassword("!QAZXSW@")); - Assert.assertEquals("5dfger(@",CommonUtils.encodePassword("5dfger(@")); - - } - - @Test - public void decodePassword() { - - PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "true"); - - Assert.assertEquals("", CommonUtils.decodePassword("")); - Assert.assertEquals("123456", CommonUtils.decodePassword("IUAjJCVeJipNVEl6TkRVMg==")); - Assert.assertEquals("!QAZXSW@", CommonUtils.decodePassword("IUAjJCVeJipJVkZCV2xoVFYwQT0=")); - Assert.assertEquals("5dfger(@", CommonUtils.decodePassword("IUAjJCVeJipOV1JtWjJWeUtFQT0=")); - - PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "false"); - - Assert.assertEquals("", CommonUtils.decodePassword("")); - Assert.assertEquals("123456", CommonUtils.decodePassword("123456")); - Assert.assertEquals("!QAZXSW@", CommonUtils.decodePassword("!QAZXSW@")); - Assert.assertEquals("5dfger(@", CommonUtils.decodePassword("5dfger(@")); - } - } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java index 59dfa2f73a..cf629ca631 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java @@ -23,17 +23,19 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.apache.dolphinscheduler.common.CommonTest; import org.apache.dolphinscheduler.common.Constants; import java.net.InetAddress; +import org.junit.After; import org.junit.Test; +import org.powermock.reflect.Whitebox; -/** - * NetUtilsTest - */ public class NetUtilsTest { + @After + public void reset() { + Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", false); + } @Test public void testGetAddr() { @@ -43,31 +45,31 @@ public class NetUtilsTest { } @Test - public void testGetHost() throws Exception { + public void testGetHost() { InetAddress address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("dolphinscheduler-worker-0.dolphinscheduler-worker-headless.default.svc.cluster.local"); when(address.getHostName()).thenReturn("dolphinscheduler-worker-0"); when(address.getHostAddress()).thenReturn("172.17.0.15"); assertEquals("172.17.0.15", NetUtils.getHost(address)); - CommonTest.setFinalStatic(Constants.class.getDeclaredField("KUBERNETES_MODE"), true); + Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true); assertEquals("dolphinscheduler-worker-0.dolphinscheduler-worker-headless", NetUtils.getHost(address)); address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("busybox-1.default-subdomain.my-namespace.svc.cluster-domain.example"); when(address.getHostName()).thenReturn("busybox-1"); - CommonTest.setFinalStatic(Constants.class.getDeclaredField("KUBERNETES_MODE"), true); + Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true); assertEquals("busybox-1.default-subdomain", NetUtils.getHost(address)); address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("dolphinscheduler.cluster-domain.example"); when(address.getHostName()).thenReturn("dolphinscheduler"); - CommonTest.setFinalStatic(Constants.class.getDeclaredField("KUBERNETES_MODE"), true); + Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true); assertEquals("dolphinscheduler.cluster-domain.example", NetUtils.getHost(address)); address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("dolphinscheduler-worker-0"); when(address.getHostName()).thenReturn("dolphinscheduler-worker-0"); - CommonTest.setFinalStatic(Constants.class.getDeclaredField("KUBERNETES_MODE"), true); + Whitebox.setInternalState(Constants.class, "KUBERNETES_MODE", true); assertEquals("dolphinscheduler-worker-0", NetUtils.getHost(address)); } diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java deleted file mode 100644 index ef0fe1e20f..0000000000 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java +++ /dev/null @@ -1,112 +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.dolphinscheduler.common.utils; - -import org.apache.commons.lang.SystemUtils; - -import java.io.IOException; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OSUtilsTest { - private static final Logger logger = LoggerFactory.getLogger(OSUtilsTest.class); - - @Test - public void getUserList() { - List userList = OSUtils.getUserList(); - Assert.assertNotEquals("System user list should not be empty", userList.size(), 0); - logger.info("OS user list : {}", userList.toString()); - } - - @Test - public void testOSMetric() { - if (!SystemUtils.IS_OS_WINDOWS) { - double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); - Assert.assertTrue(availablePhysicalMemorySize >= 0.0d); - double loadAverage = OSUtils.loadAverage(); - logger.info("loadAverage {}", loadAverage); - double memoryUsage = OSUtils.memoryUsage(); - Assert.assertTrue(memoryUsage >= 0.0d); - double cpuUsage = OSUtils.cpuUsage(); - Assert.assertTrue(cpuUsage >= 0.0d || cpuUsage == -1.0d); - } else { - // TODO window ut - } - } - - @Test - public void getGroup() { - try { - String group = OSUtils.getGroup(); - Assert.assertNotNull(group); - } catch (IOException e) { - Assert.fail("get group failed " + e.getMessage()); - } - } - - @Test - public void createUser() { - boolean result = OSUtils.createUser("test123"); - if (result) { - Assert.assertTrue("create user test123 success", true); - } else { - Assert.assertTrue("create user test123 fail", true); - } - } - - @Test - public void createUserIfAbsent() { - OSUtils.createUserIfAbsent("test123"); - Assert.assertTrue("create user test123 success", true); - } - - @Test - public void testGetSudoCmd() { - String cmd = "kill -9 1234"; - String sudoCmd = OSUtils.getSudoCmd("test123", cmd); - Assert.assertEquals("sudo -u test123 " + cmd, sudoCmd); - } - - @Test - public void exeCmd() { - if (SystemUtils.IS_OS_MAC || !SystemUtils.IS_OS_WINDOWS) { - try { - String result = OSUtils.exeCmd("echo helloWorld"); - Assert.assertEquals("helloWorld\n",result); - } catch (IOException e) { - Assert.fail("exeCmd " + e.getMessage()); - } - } - } - @Test - public void getProcessID() { - int processId = OSUtils.getProcessID(); - Assert.assertNotEquals(0, processId); - } - @Test - public void checkResource() { - boolean resource = OSUtils.checkResource(100,0); - Assert.assertTrue(resource); - resource = OSUtils.checkResource(0,Double.MAX_VALUE); - Assert.assertFalse(resource); - } - -} diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java index 68f206d28f..59b61fd980 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/placeholder/TimePlaceholderUtilsTest.java @@ -20,15 +20,22 @@ package org.apache.dolphinscheduler.common.utils.placeholder; import org.apache.dolphinscheduler.common.utils.DateUtils; import java.util.Date; +import java.util.TimeZone; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class TimePlaceholderUtilsTest { private Date date; + @BeforeClass + public static void setup() { + TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); + } + @Before public void init() { date = DateUtils.parse("20170101010101", "yyyyMMddHHmmss"); @@ -72,4 +79,4 @@ public class TimePlaceholderUtilsTest { Assert.assertEquals("20170101", TimePlaceholderUtils.getPlaceHolderTime("yyyyMMdd", date)); } -} \ No newline at end of file +} diff --git a/dolphinscheduler-dao/pom.xml b/dolphinscheduler-dao/pom.xml index f8ccb3a15a..aeea51f2d5 100644 --- a/dolphinscheduler-dao/pom.xml +++ b/dolphinscheduler-dao/pom.xml @@ -26,32 +26,16 @@ dolphinscheduler-dao ${project.artifactId} - - UTF-8 - org.apache.dolphinscheduler dolphinscheduler-common - - - protobuf-java - com.google.protobuf - - - junit - junit - test - - - org.jacoco - org.jacoco.agent - runtime - test + com.zaxxer + HikariCP com.baomidou @@ -74,38 +58,6 @@ postgresql - - org.springframework.boot - spring-boot-starter-test - test - - - org.ow2.asm - asm - - - org.springframework.boot - spring-boot - - - org.springframework.boot - spring-boot-autoconfigure - - - log4j-api - org.apache.logging.log4j - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.apache.logging.log4j - log4j-to-slf4j - - - - mysql mysql-connector-java @@ -114,10 +66,6 @@ com.h2database h2 - - com.alibaba - druid - ch.qos.logback @@ -150,14 +98,35 @@ commons-configuration + + org.yaml + snakeyaml + org.springframework spring-test test - org.yaml - snakeyaml + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + sql/ + *.yaml + + + + + diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java index 18e8e0de4d..92e3162d1c 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java @@ -17,22 +17,18 @@ package org.apache.dolphinscheduler.dao; +import com.google.common.collect.Lists; +import org.apache.commons.lang.StringUtils; import org.apache.dolphinscheduler.common.enums.AlertEvent; import org.apache.dolphinscheduler.common.enums.AlertStatus; import org.apache.dolphinscheduler.common.enums.AlertWarnLevel; import org.apache.dolphinscheduler.common.utils.JSONUtils; -import org.apache.dolphinscheduler.dao.datasource.ConnectionFactory; -import org.apache.dolphinscheduler.dao.entity.Alert; -import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; -import org.apache.dolphinscheduler.dao.entity.ProcessAlertContent; -import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; -import org.apache.dolphinscheduler.dao.entity.ProcessInstance; -import org.apache.dolphinscheduler.dao.entity.ServerAlertContent; +import org.apache.dolphinscheduler.dao.entity.*; import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper; import org.apache.dolphinscheduler.dao.mapper.AlertMapper; import org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper; - -import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Arrays; @@ -40,18 +36,8 @@ import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.google.common.collect.Lists; - @Component -public class AlertDao extends AbstractBaseDao { - - private final Logger logger = LoggerFactory.getLogger(getClass()); - +public class AlertDao { @Autowired private AlertMapper alertMapper; @@ -61,13 +47,6 @@ public class AlertDao extends AbstractBaseDao { @Autowired private AlertGroupMapper alertGroupMapper; - @Override - protected void init() { - alertMapper = ConnectionFactory.getInstance().getMapper(AlertMapper.class); - alertPluginInstanceMapper = ConnectionFactory.getInstance().getMapper(AlertPluginInstanceMapper.class); - alertGroupMapper = ConnectionFactory.getInstance().getMapper(AlertGroupMapper.class); - } - /** * insert alert * @@ -179,11 +158,9 @@ public class AlertDao extends AbstractBaseDao { } /** - * list the alert information of waiting to be executed - * - * @return alert list + * List alerts that are pending for execution */ - public List listWaitExecutionAlert() { + public List listPendingAlerts() { return alertMapper.listAlertByStatus(AlertStatus.WAIT_EXECUTION); } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoFactory.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoFactory.java index 2db41a332f..4a88a34b54 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoFactory.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoFactory.java @@ -23,7 +23,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** - * dao factory + * dao factory TODO remove */ public class DaoFactory { diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java index 53366777f7..69491ab605 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java @@ -16,20 +16,23 @@ */ package org.apache.dolphinscheduler.dao; -import com.alibaba.druid.pool.DruidDataSource; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.List; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.ConnectionUtils; import org.apache.dolphinscheduler.dao.entity.MonitorRecord; import org.apache.dolphinscheduler.dao.utils.MysqlPerformance; import org.apache.dolphinscheduler.dao.utils.PostgrePerformance; +import org.apache.dolphinscheduler.spi.enums.DbType; + +import java.sql.Connection; +import java.util.ArrayList; +import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.zaxxer.hikari.HikariDataSource; + /** * database state dao @@ -42,7 +45,7 @@ public class MonitorDBDao { public static final String VARIABLE_NAME = "variable_name"; @Autowired - private DruidDataSource dataSource; + private HikariDataSource dataSource; /** diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java index afaa0bdb00..cf69f5e50c 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/PluginDao.java @@ -17,34 +17,18 @@ package org.apache.dolphinscheduler.dao; -import static java.util.Objects.requireNonNull; - -import org.apache.dolphinscheduler.dao.datasource.ConnectionFactory; import org.apache.dolphinscheduler.dao.entity.PluginDefine; import org.apache.dolphinscheduler.dao.mapper.PluginDefineMapper; - -import org.apache.commons.collections.CollectionUtils; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -@Component -public class PluginDao extends AbstractBaseDao { - - private final Logger logger = LoggerFactory.getLogger(getClass()); +import static java.util.Objects.requireNonNull; +@Component +public class PluginDao { @Autowired private PluginDefineMapper pluginDefineMapper; - @Override - protected void init() { - pluginDefineMapper = ConnectionFactory.getInstance().getMapper(PluginDefineMapper.class); - } - /** * check plugin define table exist * @@ -74,11 +58,13 @@ public class PluginDao extends AbstractBaseDao { requireNonNull(pluginDefine.getPluginName(), "pluginName is null"); requireNonNull(pluginDefine.getPluginType(), "pluginType is null"); - List pluginDefineList = pluginDefineMapper.queryByNameAndType(pluginDefine.getPluginName(), pluginDefine.getPluginType()); - if (CollectionUtils.isEmpty(pluginDefineList)) { - return pluginDefineMapper.insert(pluginDefine); + PluginDefine currPluginDefine = pluginDefineMapper.queryByNameAndType(pluginDefine.getPluginName(), pluginDefine.getPluginType()); + if (currPluginDefine == null) { + if (pluginDefineMapper.insert(pluginDefine) == 1 && pluginDefine.getId() > 0) { + return pluginDefine.getId(); + } + throw new IllegalStateException("Failed to insert plugin definition"); } - PluginDefine currPluginDefine = pluginDefineList.get(0); if (!currPluginDefine.getPluginParams().equals(pluginDefine.getPluginParams())) { currPluginDefine.setUpdateTime(pluginDefine.getUpdateTime()); currPluginDefine.setPluginParams(pluginDefine.getPluginParams()); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java deleted file mode 100644 index 25fe5927d3..0000000000 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/ConnectionFactory.java +++ /dev/null @@ -1,149 +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.dolphinscheduler.dao.datasource; - -import com.alibaba.druid.pool.DruidDataSource; -import com.baomidou.mybatisplus.core.MybatisConfiguration; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; -import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.ibatis.mapping.Environment; -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; -import org.apache.ibatis.transaction.TransactionFactory; -import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; - -import java.sql.SQLException; - -import javax.sql.DataSource; - -import org.mybatis.spring.SqlSessionTemplate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * not spring manager connection, only use for init db, and alert module for non-spring application - * data source connection factory - */ -public class ConnectionFactory extends SpringConnectionFactory { - - private static final Logger logger = LoggerFactory.getLogger(ConnectionFactory.class); - - private static class ConnectionFactoryHolder { - private static final ConnectionFactory connectionFactory = new ConnectionFactory(); - } - - public static ConnectionFactory getInstance() { - return ConnectionFactoryHolder.connectionFactory; - } - - private ConnectionFactory() { - try { - dataSource = buildDataSource(); - sqlSessionFactory = getSqlSessionFactory(); - sqlSessionTemplate = getSqlSessionTemplate(); - } catch (Exception e) { - logger.error("Initializing ConnectionFactory error", e); - throw new RuntimeException(e); - } - } - - /** - * sql session factory - */ - private SqlSessionFactory sqlSessionFactory; - - /** - * sql session template - */ - private SqlSessionTemplate sqlSessionTemplate; - - private DataSource dataSource; - - public DataSource getDataSource() { - return dataSource; - } - - /** - * get the data source - * - * @return druid dataSource - */ - private DataSource buildDataSource() throws SQLException { - - DruidDataSource druidDataSource = dataSource(); - return druidDataSource; - } - - /** - * * get sql session factory - * - * @return sqlSessionFactory - * @throws Exception sqlSessionFactory exception - */ - private SqlSessionFactory getSqlSessionFactory() throws Exception { - TransactionFactory transactionFactory = new JdbcTransactionFactory(); - - Environment environment = new Environment("development", transactionFactory, getDataSource()); - - MybatisConfiguration configuration = new MybatisConfiguration(); - configuration.setEnvironment(environment); - configuration.setLazyLoadingEnabled(true); - configuration.addMappers("org.apache.dolphinscheduler.dao.mapper"); - configuration.addInterceptor(new PaginationInterceptor()); - - MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); - sqlSessionFactoryBean.setConfiguration(configuration); - sqlSessionFactoryBean.setDataSource(getDataSource()); - - sqlSessionFactoryBean.setTypeEnumsPackage("org.apache.dolphinscheduler.*.enums"); - sqlSessionFactory = sqlSessionFactoryBean.getObject(); - - return sqlSessionFactory; -} - - private SqlSessionTemplate getSqlSessionTemplate() { - sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactory); - return sqlSessionTemplate; - } - - /** - * get sql session - * - * @return sqlSession - */ - public SqlSession getSqlSession() { - return sqlSessionTemplate; - } - - /** - * get mapper - * - * @param type target class - * @param generic - * @return target object - */ - public T getMapper(Class type) { - try { - return getSqlSession().getMapper(type); - } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new RuntimeException("get mapper failed"); - } - } - -} diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java index 1865c78fd7..29cbefa97d 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/datasource/SpringConnectionFactory.java @@ -20,8 +20,10 @@ package org.apache.dolphinscheduler.dao.datasource; import static org.apache.dolphinscheduler.common.Constants.DATASOURCE_PROPERTIES; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.apache.dolphinscheduler.common.utils.PropertyUtils; +import org.apache.commons.lang.StringUtils; import org.apache.ibatis.mapping.DatabaseIdProvider; import org.apache.ibatis.mapping.VendorDatabaseIdProvider; import org.apache.ibatis.session.SqlSession; @@ -29,25 +31,38 @@ import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.type.JdbcType; import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; import java.util.Properties; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import javax.annotation.PostConstruct; +import javax.sql.DataSource; + +import org.h2.Driver; import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.annotation.MapperScan; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import com.alibaba.druid.pool.DruidDataSource; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.config.GlobalConfig; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; - +import com.google.common.collect.Lists; +import com.zaxxer.hikari.HikariDataSource; /** * data source connection factory @@ -58,8 +73,24 @@ public class SpringConnectionFactory { private static final Logger logger = LoggerFactory.getLogger(SpringConnectionFactory.class); - static { - PropertyUtils.loadPropertyFile(DATASOURCE_PROPERTIES); + @Autowired + private Environment environment; + + private static final AtomicBoolean H2_INITIALIZED = new AtomicBoolean(false); + + @PostConstruct + public void init() { + String datasourceProfile = getSpringActiveProfile().stream() + .filter(ProfileType.DATASOURCE_PROFILE::contains) + .findFirst() + .orElse(""); + if (StringUtils.isEmpty(datasourceProfile) || ProfileType.MYSQL.equals(datasourceProfile)) { + // default load datasource.properties + PropertyUtils.loadPropertyFile(DATASOURCE_PROPERTIES.replace("-%s", "")); + } else { + // load datasource-{spring.profiles.active}.properties + PropertyUtils.loadPropertyFile(String.format(DATASOURCE_PROPERTIES, datasourceProfile)); + } } /** @@ -75,38 +106,53 @@ public class SpringConnectionFactory { /** * get the data source * - * @return druid dataSource + * @return dataSource */ - @Bean(destroyMethod = "") - public DruidDataSource dataSource() throws SQLException { - - DruidDataSource druidDataSource = new DruidDataSource(); - - druidDataSource.setDriverClassName(PropertyUtils.getString(Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME)); - druidDataSource.setUrl(PropertyUtils.getString(Constants.SPRING_DATASOURCE_URL)); - druidDataSource.setUsername(PropertyUtils.getString(Constants.SPRING_DATASOURCE_USERNAME)); - druidDataSource.setPassword(PropertyUtils.getString(Constants.SPRING_DATASOURCE_PASSWORD)); - druidDataSource.setValidationQuery(PropertyUtils.getString(Constants.SPRING_DATASOURCE_VALIDATION_QUERY, "SELECT 1")); - - druidDataSource.setPoolPreparedStatements(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_POOL_PREPARED_STATEMENTS, true)); - druidDataSource.setTestWhileIdle(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_WHILE_IDLE, true)); - druidDataSource.setTestOnBorrow(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_ON_BORROW, true)); - druidDataSource.setTestOnReturn(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_TEST_ON_RETURN, false)); - druidDataSource.setKeepAlive(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_KEEP_ALIVE, true)); - - druidDataSource.setMinIdle(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MIN_IDLE, 5)); - druidDataSource.setMaxActive(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); - druidDataSource.setMaxWait(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_WAIT, 60000)); - druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE, 20)); - druidDataSource.setInitialSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_INITIAL_SIZE, 5)); - druidDataSource.setTimeBetweenEvictionRunsMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_TIME_BETWEEN_EVICTION_RUNS_MILLIS, 60000)); - druidDataSource.setTimeBetweenConnectErrorMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_TIME_BETWEEN_CONNECT_ERROR_MILLIS, 60000)); - druidDataSource.setMinEvictableIdleTimeMillis(PropertyUtils.getLong(Constants.SPRING_DATASOURCE_MIN_EVICTABLE_IDLE_TIME_MILLIS, 300000)); - druidDataSource.setValidationQueryTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_VALIDATION_QUERY_TIMEOUT, 3)); - //auto commit - druidDataSource.setDefaultAutoCommit(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_DEFAULT_AUTO_COMMIT, true)); - druidDataSource.init(); - return druidDataSource; + @Bean(destroyMethod = "", name = "datasource") + public DataSource dataSource() throws SQLException { + String driverClassName = PropertyUtils.getString(Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME); + if (Driver.class.getName().equals(driverClassName)) { + initializeH2Datasource(); + } + + HikariDataSource dataSource = new HikariDataSource(); + + dataSource.setDriverClassName(driverClassName); + dataSource.setJdbcUrl(PropertyUtils.getString(Constants.SPRING_DATASOURCE_URL)); + dataSource.setUsername(PropertyUtils.getString(Constants.SPRING_DATASOURCE_USERNAME)); + dataSource.setPassword(PropertyUtils.getString(Constants.SPRING_DATASOURCE_PASSWORD)); + dataSource.setConnectionTestQuery(PropertyUtils.getString(Constants.SPRING_DATASOURCE_VALIDATION_QUERY, "SELECT 1")); + + dataSource.setMinimumIdle(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MIN_IDLE, 5)); + dataSource.setMaximumPoolSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); + dataSource.setConnectionTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_CONNECTION_TIMEOUT, 30000)); + dataSource.setIdleTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_IDLE_TIMEOUT, 600000)); + dataSource.setMaxLifetime(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_LIFE_TIME, 1800000)); + dataSource.setValidationTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_VALIDATION_TIMEOUT, 5000)); + dataSource.setLeakDetectionThreshold(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_LEAK_DETECTION_THRESHOLD, 0)); + dataSource.setInitializationFailTimeout(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_INITIALIZATION_FAIL_TIMEOUT, 1)); + + dataSource.setAutoCommit(PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_IS_AUTOCOMMIT, true)); + + dataSource.addDataSourceProperty(Constants.CACHE_PREP_STMTS, PropertyUtils.getBoolean(Constants.SPRING_DATASOURCE_CACHE_PREP_STMTS, true)); + dataSource.addDataSourceProperty(Constants.PREP_STMT_CACHE_SIZE, PropertyUtils.getInt(Constants.SPRING_DATASOURCE_PREP_STMT_CACHE_SIZE, 250)); + dataSource.addDataSourceProperty(Constants.PREP_STMT_CACHE_SQL_LIMIT, PropertyUtils.getInt(Constants.SPRING_DATASOURCE_PREP_STMT_CACHE_SQL_LIMIT, 2048)); + + logger.info("Initialize DataSource DataSource success"); + return dataSource; + } + + private void initializeH2Datasource() { + if (H2_INITIALIZED.compareAndSet(false, true)) { + EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder(new FileSystemResourceLoader()); + embeddedDatabaseBuilder + .setType(EmbeddedDatabaseType.H2) + .setScriptEncoding(Constants.UTF_8) + .setName("dolphinscheduler;MODE=MySQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1") + .addScript(PropertyUtils.getString("spring.datasource.sql.schema", "classpath:sql/dolphinscheduler_h2.sql")) + .build(); + logger.info("Initialize H2 DataSource success"); + } } /** @@ -115,8 +161,8 @@ public class SpringConnectionFactory { * @return DataSourceTransactionManager */ @Bean - public DataSourceTransactionManager transactionManager() throws SQLException { - return new DataSourceTransactionManager(dataSource()); + public DataSourceTransactionManager transactionManager(DataSource dataSource) { + return new DataSourceTransactionManager(dataSource); } /** @@ -126,7 +172,7 @@ public class SpringConnectionFactory { * @throws Exception sqlSessionFactory exception */ @Bean - public SqlSessionFactory sqlSessionFactory() throws Exception { + public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { MybatisConfiguration configuration = new MybatisConfiguration(); configuration.setMapUnderscoreToCamelCase(true); configuration.setCacheEnabled(false); @@ -135,7 +181,7 @@ public class SpringConnectionFactory { configuration.addInterceptor(paginationInterceptor()); MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); sqlSessionFactoryBean.setConfiguration(configuration); - sqlSessionFactoryBean.setDataSource(dataSource()); + sqlSessionFactoryBean.setDataSource(dataSource); GlobalConfig.DbConfig dbConfig = new GlobalConfig.DbConfig(); dbConfig.setIdType(IdType.AUTO); @@ -156,8 +202,8 @@ public class SpringConnectionFactory { * @return SqlSession */ @Bean - public SqlSession sqlSession() throws Exception { - return new SqlSessionTemplate(sqlSessionFactory()); + public SqlSession sqlSession(SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); } @Bean @@ -170,4 +216,17 @@ public class SpringConnectionFactory { databaseIdProvider.setProperties(properties); return databaseIdProvider; } + + /** + * Get spring active profile, which will be set by -Dspring.profiles.active=api, or in application.xml + * + * @return + */ + private List getSpringActiveProfile() { + if (environment != null) { + return Lists.newArrayList(environment.getActiveProfiles()); + } + String property = System.getProperty("spring.profiles.active", ""); + return Arrays.stream(property.split(",")).map(String::trim).collect(Collectors.toList()); + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DataSource.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DataSource.java index ecd5be0455..b15d0ef7e1 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DataSource.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DataSource.java @@ -16,14 +16,15 @@ */ package org.apache.dolphinscheduler.dao.entity; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.spi.enums.DbType; + +import java.util.Date; + import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - -import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; @TableName("t_ds_datasource") public class DataSource { diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/MonitorRecord.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/MonitorRecord.java index 318f24535f..1d6ebe0a08 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/MonitorRecord.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/MonitorRecord.java @@ -16,12 +16,13 @@ */ package org.apache.dolphinscheduler.dao.entity; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.Flag; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + /** * monitor record for database */ diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java index 1ce76707aa..1bca24aab5 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineMapper.java @@ -17,14 +17,12 @@ package org.apache.dolphinscheduler.dao.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.dolphinscheduler.dao.entity.PluginDefine; - import org.apache.ibatis.annotations.Param; import java.util.List; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - public interface PluginDefineMapper extends BaseMapper { /** @@ -64,5 +62,5 @@ public interface PluginDefineMapper extends BaseMapper { * @param pluginType * @return */ - List queryByNameAndType(@Param("pluginName") String pluginName, @Param("pluginType") String pluginType); + PluginDefine queryByNameAndType(@Param("pluginName") String pluginName, @Param("pluginType") String pluginType); } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/DolphinSchedulerManager.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/DolphinSchedulerManager.java index a6ad6ca8c3..9de49a4c52 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/DolphinSchedulerManager.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/DolphinSchedulerManager.java @@ -14,103 +14,86 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.dolphinscheduler.dao.upgrade; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.utils.SchemaUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.Connection; import java.util.List; -/** - * upgrade manager - */ +@Service +@Profile("shell-cli") public class DolphinSchedulerManager { private static final Logger logger = LoggerFactory.getLogger(DolphinSchedulerManager.class); - UpgradeDao upgradeDao; - /** - * init upgrade dao - */ - private void initUpgradeDao() { - DbType dbType = UpgradeDao.getDbType(); - if (dbType != null) { - switch (dbType) { - case MYSQL: - upgradeDao = MysqlUpgradeDao.getInstance(); - break; - case POSTGRESQL: - upgradeDao = PostgresqlUpgradeDao.getInstance(); - break; - default: - logger.error("not support sql type: {},can't upgrade", dbType); - throw new IllegalArgumentException("not support sql type,can't upgrade"); - } - } + private final UpgradeDao upgradeDao; + + public DolphinSchedulerManager(DataSource dataSource, List daos) throws Exception { + final DbType type = getCurrentDbType(dataSource); + upgradeDao = daos.stream() + .filter(it -> it.getDbType() == type) + .findFirst() + .orElseThrow(() -> new RuntimeException( + "Cannot find UpgradeDao implementation for db type: " + type + )); } - /** - * constructor init - */ - public DolphinSchedulerManager() { - initUpgradeDao(); + private DbType getCurrentDbType(DataSource dataSource) throws Exception { + try (Connection conn = dataSource.getConnection()) { + String name = conn.getMetaData().getDatabaseProductName().toUpperCase(); + return DbType.valueOf(name); + } } - /** - * init DolphinScheduler - */ public void initDolphinScheduler() { // Determines whether the dolphinscheduler table structure has been init - if (upgradeDao.isExistsTable("t_escheduler_version") || - upgradeDao.isExistsTable("t_ds_version") || - upgradeDao.isExistsTable("t_escheduler_queue")) { + if (upgradeDao.isExistsTable("t_escheduler_version") + || upgradeDao.isExistsTable("t_ds_version") + || upgradeDao.isExistsTable("t_escheduler_queue")) { logger.info("The database has been initialized. Skip the initialization step"); return; } this.initDolphinSchedulerSchema(); } - /** - * init DolphinScheduler Schema - */ public void initDolphinSchedulerSchema() { - logger.info("Start initializing the DolphinScheduler manager table structure"); upgradeDao.initSchema(); } - - /** - * upgrade DolphinScheduler - */ - public void upgradeDolphinScheduler() { - + public void upgradeDolphinScheduler() throws IOException { // Gets a list of all upgrades List schemaList = SchemaUtils.getAllSchemaList(); - if(schemaList == null || schemaList.size() == 0) { + if (schemaList == null || schemaList.size() == 0) { logger.info("There is no schema to upgrade!"); - }else { - - String version = ""; + } else { + String version; // Gets the version of the current system if (upgradeDao.isExistsTable("t_escheduler_version")) { version = upgradeDao.getCurrentVersion("t_escheduler_version"); - }else if(upgradeDao.isExistsTable("t_ds_version")){ + } else if (upgradeDao.isExistsTable("t_ds_version")) { version = upgradeDao.getCurrentVersion("t_ds_version"); - }else if(upgradeDao.isExistsColumn("t_escheduler_queue","create_time")){ + } else if (upgradeDao.isExistsColumn("t_escheduler_queue", "create_time")) { version = "1.0.1"; - }else if(upgradeDao.isExistsTable("t_escheduler_queue")){ + } else if (upgradeDao.isExistsTable("t_escheduler_queue")) { version = "1.0.0"; - }else{ + } else { logger.error("Unable to determine current software version, so cannot upgrade"); throw new RuntimeException("Unable to determine current software version, so cannot upgrade"); } // The target version of the upgrade String schemaVersion = ""; - for(String schemaDir : schemaList) { + for (String schemaDir : schemaList) { schemaVersion = schemaDir.split("_")[0]; - if(SchemaUtils.isAGreatVersion(schemaVersion , version)) { + if (SchemaUtils.isAGreatVersion(schemaVersion, version)) { logger.info("upgrade DolphinScheduler metadata version from {} to {}", version, schemaVersion); logger.info("Begin upgrading DolphinScheduler's table structure"); upgradeDao.upgradeDolphinScheduler(schemaDir); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java index 8d92b90709..c27e7a0159 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/MysqlUpgradeDao.java @@ -17,38 +17,36 @@ package org.apache.dolphinscheduler.dao.upgrade; import org.apache.dolphinscheduler.common.utils.ConnectionUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; +import javax.sql.DataSource; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; -/** - * mysql upgrade dao - */ +@Service +@Profile("shell-cli") public class MysqlUpgradeDao extends UpgradeDao { - public static final Logger logger = LoggerFactory.getLogger(MysqlUpgradeDao.class); - /** - * mysql upgrade dao holder - */ - private static class MysqlUpgradeDaoHolder { - private static final MysqlUpgradeDao INSTANCE = new MysqlUpgradeDao(); + private MysqlUpgradeDao(DataSource dataSource) { + super(dataSource); } - /** - * mysql upgrade dao constructor - */ - private MysqlUpgradeDao() { + @Override + protected String initSqlPath() { + return "create/release-1.0.0_schema/mysql"; } - public static final MysqlUpgradeDao getInstance() { - return MysqlUpgradeDaoHolder.INSTANCE; + @Override + protected DbType getDbType() { + return DbType.MYSQL; } - /** * determines whether a table exists * @param tableName tableName diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java index 2caf54b374..b9cd625c2c 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/PostgresqlUpgradeDao.java @@ -17,44 +17,38 @@ package org.apache.dolphinscheduler.dao.upgrade; import org.apache.dolphinscheduler.common.utils.ConnectionUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; +import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -/** - * postgresql upgrade dao - */ +@Service +@Profile("shell-cli") public class PostgresqlUpgradeDao extends UpgradeDao { - public static final Logger logger = LoggerFactory.getLogger(PostgresqlUpgradeDao.class); - private static final String SCHEMA = getSchema(); - /** - * postgresql upgrade dao holder - */ - private static class PostgresqlUpgradeDaoHolder { - private static final PostgresqlUpgradeDao INSTANCE = new PostgresqlUpgradeDao(); + private PostgresqlUpgradeDao(DataSource dataSource) { + super(dataSource); } - /** - * PostgresqlUpgradeDao Constructor - */ - private PostgresqlUpgradeDao() { + @Override + protected String initSqlPath() { + return "create/release-1.2.0_schema/postgresql"; } - public static final PostgresqlUpgradeDao getInstance() { - return PostgresqlUpgradeDaoHolder.INSTANCE; + @Override + protected DbType getDbType() { + return DbType.POSTGRESQL; } - /** - * getSchema - * @return schema - */ - public static String getSchema(){ + public String getSchema() { Connection conn = null; PreparedStatement pstmt = null; ResultSet resultSet = null; @@ -62,14 +56,14 @@ public class PostgresqlUpgradeDao extends UpgradeDao { conn = dataSource.getConnection(); pstmt = conn.prepareStatement("select current_schema()"); resultSet = pstmt.executeQuery(); - while (resultSet.next()){ - if(resultSet.isFirst()){ + while (resultSet.next()) { + if (resultSet.isFirst()) { return resultSet.getString(1); } } } catch (SQLException e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage(), e); } finally { ConnectionUtils.releaseResource(resultSet, pstmt, conn); } @@ -79,6 +73,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao { /** * determines whether a table exists + * * @param tableName tableName * @return if table exist return true,else return false */ @@ -89,12 +84,12 @@ public class PostgresqlUpgradeDao extends UpgradeDao { try { conn = dataSource.getConnection(); - rs = conn.getMetaData().getTables(conn.getCatalog(), SCHEMA, tableName, null); + rs = conn.getMetaData().getTables(conn.getCatalog(), getSchema(), tableName, null); return rs.next(); } catch (SQLException e) { - logger.error(e.getMessage(),e); - throw new RuntimeException(e.getMessage(),e); + logger.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); } finally { ConnectionUtils.releaseResource(rs, conn); } @@ -103,21 +98,22 @@ public class PostgresqlUpgradeDao extends UpgradeDao { /** * determines whether a field exists in the specified table + * * @param tableName tableName * @param columnName columnName - * @return if column name exist return true,else return false + * @return if column name exist return true,else return false */ @Override - public boolean isExistsColumn(String tableName,String columnName) { + public boolean isExistsColumn(String tableName, String columnName) { Connection conn = null; ResultSet rs = null; try { conn = dataSource.getConnection(); - rs = conn.getMetaData().getColumns(conn.getCatalog(), SCHEMA,tableName,columnName); + rs = conn.getMetaData().getColumns(conn.getCatalog(), getSchema(), tableName, columnName); return rs.next(); } catch (SQLException e) { - logger.error(e.getMessage(),e); - throw new RuntimeException(e.getMessage(),e); + logger.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); } finally { ConnectionUtils.releaseResource(rs, conn); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java index 3eba40572d..74135dd39a 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java @@ -14,168 +14,76 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.dolphinscheduler.dao.upgrade; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.ConditionType; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.enums.Flag; -import org.apache.dolphinscheduler.common.enums.Priority; -import org.apache.dolphinscheduler.common.enums.TaskType; -import org.apache.dolphinscheduler.common.enums.TimeoutFlag; +import org.apache.dolphinscheduler.common.enums.*; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.TaskTimeoutParameter; -import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; -import org.apache.dolphinscheduler.common.utils.ConnectionUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; -import org.apache.dolphinscheduler.common.utils.SchemaUtils; -import org.apache.dolphinscheduler.common.utils.ScriptRunner; -import org.apache.dolphinscheduler.dao.AbstractBaseDao; -import org.apache.dolphinscheduler.dao.datasource.ConnectionFactory; +import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; -import org.apache.commons.lang.StringUtils; - -import java.io.File; +import javax.sql.DataSource; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; import java.io.Reader; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; -import javax.sql.DataSource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -public abstract class UpgradeDao extends AbstractBaseDao { - +public abstract class UpgradeDao { public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class); private static final String T_VERSION_NAME = "t_escheduler_version"; private static final String T_NEW_VERSION_NAME = "t_ds_version"; - private static final String rootDir = System.getProperty("user.dir"); - protected static final DataSource dataSource = getDataSource(); - private static final DbType dbType = getCurrentDbType(); - - @Override - protected void init() { + protected final DataSource dataSource; + protected UpgradeDao(DataSource dataSource) { + this.dataSource = dataSource; } - /** - * get datasource - * @return DruidDataSource - */ - public static DataSource getDataSource(){ - return ConnectionFactory.getInstance().getDataSource(); - } + protected abstract String initSqlPath(); - /** - * get db type - * @return dbType - */ - public static DbType getDbType(){ - return dbType; - } + protected abstract DbType getDbType(); - /** - * get current dbType - * @return - */ - private static DbType getCurrentDbType(){ - Connection conn = null; - try { - conn = dataSource.getConnection(); - String name = conn.getMetaData().getDatabaseProductName().toUpperCase(); - return DbType.valueOf(name); - } catch (Exception e) { - logger.error(e.getMessage(),e); - return null; - }finally { - ConnectionUtils.releaseResource(conn); - } - } - - /** - * init schema - */ public void initSchema() { - DbType dbType = getDbType(); - String initSqlPath = ""; - if (dbType != null) { - switch (dbType) { - case MYSQL: - initSqlPath = "/sql/create/release-1.0.0_schema/mysql/"; - initSchema(initSqlPath); - break; - case POSTGRESQL: - initSqlPath = "/sql/create/release-1.2.0_schema/postgresql/"; - initSchema(initSqlPath); - break; - default: - logger.error("not support sql type: {},can't upgrade", dbType); - throw new IllegalArgumentException("not support sql type,can't upgrade"); - } - } - } - - - /** - * init scheam - * - * @param initSqlPath initSqlPath - */ - public void initSchema(String initSqlPath) { - // Execute the dolphinscheduler DDL, it cannot be rolled back - runInitDDL(initSqlPath); + runInitDDL(); // Execute the dolphinscheduler DML, it can be rolled back - runInitDML(initSqlPath); - - + runInitDML(); } - /** - * run DML - * - * @param initSqlPath initSqlPath - */ - private void runInitDML(String initSqlPath) { + private void runInitDML() { + Resource mysqlSQLFilePath = new ClassPathResource("sql/" + initSqlPath() + "/dolphinscheduler_dml.sql"); Connection conn = null; - if (StringUtils.isEmpty(rootDir)) { - throw new RuntimeException("Environment variable user.dir not found"); - } - String mysqlSQLFilePath = rootDir + initSqlPath + "dolphinscheduler_dml.sql"; try { conn = dataSource.getConnection(); conn.setAutoCommit(false); // Execute the dolphinscheduler_dml.sql script to import related data of dolphinscheduler ScriptRunner initScriptRunner = new ScriptRunner(conn, false, true); - Reader initSqlReader = new FileReader(mysqlSQLFilePath); + Reader initSqlReader = new InputStreamReader(mysqlSQLFilePath.getInputStream()); initScriptRunner.runScript(initSqlReader); conn.commit(); @@ -199,69 +107,27 @@ public abstract class UpgradeDao extends AbstractBaseDao { throw new RuntimeException(e.getMessage(), e); } finally { ConnectionUtils.releaseResource(conn); - } } - /** - * run DDL - * - * @param initSqlPath initSqlPath - */ - private void runInitDDL(String initSqlPath) { - Connection conn = null; - if (StringUtils.isEmpty(rootDir)) { - throw new RuntimeException("Environment variable user.dir not found"); - } - //String mysqlSQLFilePath = rootDir + "/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql"; - String mysqlSQLFilePath = rootDir + initSqlPath + "dolphinscheduler_ddl.sql"; - try { - conn = dataSource.getConnection(); + private void runInitDDL() { + Resource mysqlSQLFilePath = new ClassPathResource("sql/" + initSqlPath() + "/dolphinscheduler_ddl.sql"); + try (Connection conn = dataSource.getConnection()) { // Execute the dolphinscheduler_ddl.sql script to create the table structure of dolphinscheduler ScriptRunner initScriptRunner = new ScriptRunner(conn, true, true); - Reader initSqlReader = new FileReader(mysqlSQLFilePath); + Reader initSqlReader = new InputStreamReader(mysqlSQLFilePath.getInputStream()); initScriptRunner.runScript(initSqlReader); - - } catch (IOException e) { - - logger.error(e.getMessage(), e); - throw new RuntimeException(e.getMessage(), e); } catch (Exception e) { - logger.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); - } finally { - ConnectionUtils.releaseResource(conn); - } - } - /** - * determines whether a table exists - * - * @param tableName tableName - * @return if table exist return true,else return false - */ public abstract boolean isExistsTable(String tableName); - /** - * determines whether a field exists in the specified table - * - * @param tableName tableName - * @param columnName columnName - * @return if column name exist return true,else return false - */ public abstract boolean isExistsColumn(String tableName, String columnName); - - /** - * get current version - * - * @param versionName versionName - * @return version - */ public String getCurrentVersion(String versionName) { String sql = String.format("select version from %s", versionName); Connection conn = null; @@ -287,18 +153,11 @@ public abstract class UpgradeDao extends AbstractBaseDao { } } - - /** - * upgrade DolphinScheduler - * - * @param schemaDir schema dir - */ public void upgradeDolphinScheduler(String schemaDir) { upgradeDolphinSchedulerDDL(schemaDir, "dolphinscheduler_ddl.sql"); upgradeDolphinSchedulerDML(schemaDir); } - /** * upgrade DolphinScheduler worker group * ds-1.3.0 modify the worker group for process definition json @@ -341,7 +200,7 @@ public abstract class UpgradeDao extends AbstractBaseDao { for (int i = 0; i < tasks.size(); i++) { ObjectNode task = (ObjectNode) tasks.path(i); ObjectNode workerGroupNode = (ObjectNode) task.path("workerGroupId"); - Integer workerGroupId = -1; + int workerGroupId = -1; if (workerGroupNode != null && workerGroupNode.canConvertToInt()) { workerGroupId = workerGroupNode.asInt(-1); } @@ -366,9 +225,6 @@ public abstract class UpgradeDao extends AbstractBaseDao { } } - /** - * updateProcessDefinitionJsonResourceList - */ protected void updateProcessDefinitionJsonResourceList() { ResourceDao resourceDao = new ResourceDao(); ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); @@ -426,17 +282,9 @@ public abstract class UpgradeDao extends AbstractBaseDao { } - /** - * upgradeDolphinScheduler DML - * - * @param schemaDir schemaDir - */ private void upgradeDolphinSchedulerDML(String schemaDir) { String schemaVersion = schemaDir.split("_")[0]; - if (StringUtils.isEmpty(rootDir)) { - throw new RuntimeException("Environment variable user.dir not found"); - } - String sqlFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/dolphinscheduler_dml.sql", rootDir, schemaDir, getDbType().name().toLowerCase()); + Resource sqlFilePath = new ClassPathResource(String.format("sql/upgrade/%s/%s/dolphinscheduler_dml.sql", schemaDir, getDbType().name().toLowerCase())); logger.info("sqlSQLFilePath" + sqlFilePath); Connection conn = null; PreparedStatement pstmt = null; @@ -445,7 +293,7 @@ public abstract class UpgradeDao extends AbstractBaseDao { conn.setAutoCommit(false); // Execute the upgraded dolphinscheduler dml ScriptRunner scriptRunner = new ScriptRunner(conn, false, true); - Reader sqlReader = new FileReader(new File(sqlFilePath)); + Reader sqlReader = new InputStreamReader(sqlFilePath.getInputStream()); scriptRunner.runScript(sqlReader); if (isExistsTable(T_VERSION_NAME)) { // Change version in the version table to the new version @@ -477,16 +325,6 @@ public abstract class UpgradeDao extends AbstractBaseDao { } logger.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); - } catch (SQLException e) { - try { - if (null != conn) { - conn.rollback(); - } - } catch (SQLException e1) { - logger.error(e1.getMessage(), e1); - } - logger.error(e.getMessage(), e); - throw new RuntimeException(e.getMessage(), e); } catch (Exception e) { try { if (null != conn) { @@ -509,10 +347,7 @@ public abstract class UpgradeDao extends AbstractBaseDao { * @param schemaDir schemaDir */ private void upgradeDolphinSchedulerDDL(String schemaDir, String scriptFile) { - if (StringUtils.isEmpty(rootDir)) { - throw new RuntimeException("Environment variable user.dir not found"); - } - String sqlFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/{3}", rootDir, schemaDir, getDbType().name().toLowerCase(), scriptFile); + Resource sqlFilePath = new ClassPathResource(String.format("sql/upgrade/%s/%s/%s", schemaDir, getDbType().name().toLowerCase(), scriptFile)); Connection conn = null; PreparedStatement pstmt = null; try { @@ -522,23 +357,14 @@ public abstract class UpgradeDao extends AbstractBaseDao { conn.setAutoCommit(true); // Execute the dolphinscheduler ddl.sql for the upgrade ScriptRunner scriptRunner = new ScriptRunner(conn, true, true); - Reader sqlReader = new FileReader(new File(sqlFilePath)); + Reader sqlReader = new InputStreamReader(sqlFilePath.getInputStream()); scriptRunner.runScript(sqlReader); } catch (FileNotFoundException e) { logger.error(e.getMessage(), e); throw new RuntimeException("sql file not found ", e); - } catch (IOException e) { - - logger.error(e.getMessage(), e); - throw new RuntimeException(e.getMessage(), e); - } catch (SQLException e) { - - logger.error(e.getMessage(), e); - throw new RuntimeException(e.getMessage(), e); } catch (Exception e) { - logger.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } finally { @@ -623,7 +449,7 @@ public abstract class UpgradeDao extends AbstractBaseDao { List taskDefinitionLogs, Map>> processTaskMap) throws Exception { Map processDefinitionMap = processDefinitions.stream() - .collect(Collectors.toMap(ProcessDefinition::getId, processDefinition -> processDefinition)); + .collect(Collectors.toMap(ProcessDefinition::getId, processDefinition -> processDefinition)); Date now = new Date(); for (Map.Entry entry : processDefinitionJsonMap.entrySet()) { if (entry.getValue() == null) { @@ -774,8 +600,8 @@ public abstract class UpgradeDao extends AbstractBaseDao { } public void convertDependence(List taskDefinitionLogs, - Map projectIdCodeMap, - Map>> processTaskMap) { + Map projectIdCodeMap, + Map>> processTaskMap) { for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (TaskType.DEPENDENT.getDesc().equals(taskDefinitionLog.getTaskType())) { ObjectNode taskParams = JSONUtils.parseObject(taskDefinitionLog.getTaskParams()); diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/CreateDolphinScheduler.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/CreateDolphinScheduler.java index 14eceffa72..d1ac2e231a 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/CreateDolphinScheduler.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/CreateDolphinScheduler.java @@ -18,32 +18,46 @@ package org.apache.dolphinscheduler.dao.upgrade.shell; import org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; -/** - * create DolphinScheduler - * - */ +@ComponentScan(value = "org.apache.dolphinscheduler.dao") +@EnableAutoConfiguration(exclude = {QuartzAutoConfiguration.class}) public class CreateDolphinScheduler { + public static void main(String[] args) { + new SpringApplicationBuilder(CreateDolphinScheduler.class) + .profiles("shell-create", "shell-cli") + .web(WebApplicationType.NONE) + .run(args); + } + + @Component + @Profile("shell-create") + static class CreateRunner implements CommandLineRunner { + private static final Logger logger = LoggerFactory.getLogger(CreateRunner.class); + + private final DolphinSchedulerManager dolphinSchedulerManager; + + CreateRunner(DolphinSchedulerManager dolphinSchedulerManager) { + this.dolphinSchedulerManager = dolphinSchedulerManager; + } - private static final Logger logger = LoggerFactory.getLogger(CreateDolphinScheduler.class); - - /** - * create dolphin scheduler db - * @param args args - */ - public static void main(String[] args) { - DolphinSchedulerManager dolphinSchedulerManager = new DolphinSchedulerManager(); - try { - dolphinSchedulerManager.initDolphinScheduler(); - logger.info("init DolphinScheduler finished"); - dolphinSchedulerManager.upgradeDolphinScheduler(); - logger.info("upgrade DolphinScheduler finished"); - logger.info("create DolphinScheduler success"); - } catch (Exception e) { - logger.error("create DolphinScheduler failed",e); - } - - } + @Override + public void run(String... args) throws Exception { + dolphinSchedulerManager.initDolphinScheduler(); + logger.info("init DolphinScheduler finished"); + dolphinSchedulerManager.upgradeDolphinScheduler(); + logger.info("upgrade DolphinScheduler finished"); + logger.info("create DolphinScheduler success"); + } + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/InitDolphinScheduler.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/InitDolphinScheduler.java index 3bcb3abc03..261b98895d 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/InitDolphinScheduler.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/InitDolphinScheduler.java @@ -17,26 +17,43 @@ package org.apache.dolphinscheduler.dao.upgrade.shell; import org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; -/** - * init DolphinScheduler - * - */ +@ComponentScan(value = "org.apache.dolphinscheduler.dao") +@EnableAutoConfiguration(exclude = {QuartzAutoConfiguration.class}) public class InitDolphinScheduler { + public static void main(String[] args) { + new SpringApplicationBuilder(InitDolphinScheduler.class) + .profiles("shell-init", "shell-cli") + .web(WebApplicationType.NONE) + .run(args); + } + + @Component + @Profile("shell-init") + static class InitRunner implements CommandLineRunner { + private static final Logger logger = LoggerFactory.getLogger(InitRunner.class); + + private final DolphinSchedulerManager dolphinSchedulerManager; - private static final Logger logger = LoggerFactory.getLogger(InitDolphinScheduler.class); + InitRunner(DolphinSchedulerManager dolphinSchedulerManager) { + this.dolphinSchedulerManager = dolphinSchedulerManager; + } - /** - * init dolphin scheduler db - * @param args args - */ - public static void main(String[] args) { - Thread.currentThread().setName("manager-InitDolphinScheduler"); - DolphinSchedulerManager dolphinSchedulerManager = new DolphinSchedulerManager(); - dolphinSchedulerManager.initDolphinScheduler(); - logger.info("init DolphinScheduler finished"); - - } + @Override + public void run(String... args) throws Exception { + dolphinSchedulerManager.initDolphinScheduler(); + logger.info("init DolphinScheduler finished"); + } + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/UpgradeDolphinScheduler.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/UpgradeDolphinScheduler.java index 293b555c94..427f2f5973 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/UpgradeDolphinScheduler.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/shell/UpgradeDolphinScheduler.java @@ -17,31 +17,43 @@ package org.apache.dolphinscheduler.dao.upgrade.shell; import org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; -/** - * upgrade DolphinScheduler - */ +@ComponentScan(value = "org.apache.dolphinscheduler.dao") +@EnableAutoConfiguration(exclude = {QuartzAutoConfiguration.class}) public class UpgradeDolphinScheduler { - private static final Logger logger = LoggerFactory.getLogger(UpgradeDolphinScheduler.class); + public static void main(String[] args) { + new SpringApplicationBuilder(UpgradeDolphinScheduler.class) + .profiles("shell-upgrade", "shell-cli") + .web(WebApplicationType.NONE) + .run(args); + } + + @Component + @Profile("shell-upgrade") + static class UpgradeRunner implements CommandLineRunner { + private static final Logger logger = LoggerFactory.getLogger(UpgradeRunner.class); + + private final DolphinSchedulerManager dolphinSchedulerManager; + + UpgradeRunner(DolphinSchedulerManager dolphinSchedulerManager) { + this.dolphinSchedulerManager = dolphinSchedulerManager; + } - /** - * upgrade dolphin scheduler db - * @param args args - */ - public static void main(String[] args) { - DolphinSchedulerManager dolphinSchedulerManager = new DolphinSchedulerManager(); - try { - dolphinSchedulerManager.upgradeDolphinScheduler(); - logger.info("upgrade DolphinScheduler success"); - } catch (Exception e) { - logger.error(e.getMessage(),e); - logger.info("Upgrade DolphinScheduler failed"); - throw new RuntimeException(e); - } - } - - - + @Override + public void run(String... args) throws Exception { + dolphinSchedulerManager.upgradeDolphinScheduler(); + logger.info("upgrade DolphinScheduler success"); + } + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MysqlPerformance.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MysqlPerformance.java index e7e9c70f47..e00f5e7e03 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MysqlPerformance.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MysqlPerformance.java @@ -14,20 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dolphinscheduler.dao.utils; +package org.apache.dolphinscheduler.dao.utils; import static org.apache.dolphinscheduler.dao.MonitorDBDao.VARIABLE_NAME; +import org.apache.dolphinscheduler.common.enums.Flag; +import org.apache.dolphinscheduler.dao.entity.MonitorRecord; +import org.apache.dolphinscheduler.spi.enums.DbType; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Date; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.enums.Flag; -import org.apache.dolphinscheduler.dao.entity.MonitorRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java index b1cdf6f179..6afd9706e6 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java @@ -14,17 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.dolphinscheduler.dao.utils; +import org.apache.dolphinscheduler.common.enums.Flag; +import org.apache.dolphinscheduler.dao.entity.MonitorRecord; +import org.apache.dolphinscheduler.spi.enums.DbType; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Date; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.enums.Flag; -import org.apache.dolphinscheduler.dao.entity.MonitorRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/create/release-1.0.0_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/dolphinscheduler_h2.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql similarity index 100% rename from sql/dolphinscheduler_h2.sql rename to dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql diff --git a/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql similarity index 100% rename from sql/dolphinscheduler_mysql.sql rename to dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql diff --git a/sql/dolphinscheduler_postgre.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgre.sql similarity index 100% rename from sql/dolphinscheduler_postgre.sql rename to dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgre.sql diff --git a/sql/soft_version b/dolphinscheduler-dao/src/main/resources/sql/soft_version similarity index 100% rename from sql/soft_version rename to dolphinscheduler-dao/src/main/resources/sql/soft_version diff --git a/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.1_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.0.2_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.1.0_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.2.0_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.0_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.2_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.5_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.6_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/1.3.7_schema/postgresql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl_post.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl_post.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl_post.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_ddl_post.sql diff --git a/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/mysql/dolphinscheduler_dml.sql diff --git a/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql diff --git a/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl_post.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl_post.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl_post.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl_post.sql diff --git a/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_dml.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_dml.sql similarity index 100% rename from sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_dml.sql rename to dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_dml.sql diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/AlertDaoTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/AlertDaoTest.java index 7b9e8c6f35..0a2ca669cb 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/AlertDaoTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/AlertDaoTest.java @@ -18,20 +18,31 @@ package org.apache.dolphinscheduler.dao; import org.apache.dolphinscheduler.common.enums.AlertStatus; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.apache.dolphinscheduler.dao.entity.Alert; - -import java.util.List; - import org.junit.Assert; import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + +@ActiveProfiles(ProfileType.H2) +@RunWith(SpringRunner.class) +@SpringBootTest +@SpringBootApplication @Transactional public class AlertDaoTest { + @Autowired + private AlertDao alertDao; @Test public void testAlertDao() { - AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); Alert alert = new Alert(); alert.setTitle("Mysql Exception"); alert.setContent("[\"alarm time:2018-02-05\", \"service name:MYSQL_ALTER\", \"alarm name:MYSQL_ALTER_DUMP\", " @@ -40,23 +51,22 @@ public class AlertDaoTest { alert.setAlertStatus(AlertStatus.WAIT_EXECUTION); alertDao.addAlert(alert); - List alerts = alertDao.listWaitExecutionAlert(); + List alerts = alertDao.listPendingAlerts(); Assert.assertNotNull(alerts); Assert.assertNotEquals(0, alerts.size()); } @Test public void testSendServerStopedAlert() { - AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class); int alertGroupId = 1; String host = "127.0.0.998165432"; String serverType = "Master"; alertDao.sendServerStopedAlert(alertGroupId, host, serverType); alertDao.sendServerStopedAlert(alertGroupId, host, serverType); - long count = alertDao.listWaitExecutionAlert() - .stream() - .filter(alert -> alert.getContent().contains(host)) - .count(); + long count = alertDao.listPendingAlerts() + .stream() + .filter(alert -> alert.getContent().contains(host)) + .count(); Assert.assertEquals(1L, count); } } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~HEAD b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/BaseDaoTest.java similarity index 59% rename from dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~HEAD rename to dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/BaseDaoTest.java index a96cec9158..ddb87d5a4e 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/security/SecurityConfigLDAPTest.java~HEAD +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/BaseDaoTest.java @@ -15,31 +15,20 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.api.security; +package org.apache.dolphinscheduler.dao; -import org.apache.dolphinscheduler.api.ApiApplicationServer; - -import org.junit.Assert; -import org.junit.Test; +import org.apache.dolphinscheduler.common.enums.ProfileType; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; @RunWith(SpringRunner.class) -@SpringBootTest(classes = ApiApplicationServer.class) -@TestPropertySource(properties = { - "security.authentication.type=LDAP", -}) -public class SecurityConfigLDAPTest { - - @Autowired - private SecurityConfig securityConfig; - - @Test - public void testAuthenticator() { - Authenticator authenticator = securityConfig.authenticator(); - Assert.assertNotNull(authenticator); - } +@SpringBootTest +@ActiveProfiles(value = ProfileType.H2) +@Transactional +@Rollback +public abstract class BaseDaoTest { } diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java index a45c520724..f8651af14e 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/DataSourceMapperTest.java @@ -25,12 +25,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.DatasourceUser; import org.apache.dolphinscheduler.dao.entity.User; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Arrays; import java.util.Date; diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineTest.java index d8636a6fbc..c3b93448a1 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/PluginDefineTest.java @@ -17,28 +17,18 @@ package org.apache.dolphinscheduler.dao.mapper; +import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.PluginDefine; - -import java.util.List; - import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.Rollback; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; -@RunWith(SpringRunner.class) -@SpringBootTest -@Transactional -@Rollback(true) +import java.util.List; -public class PluginDefineTest { +public class PluginDefineTest extends BaseDaoTest { @Autowired - PluginDefineMapper pluginDefineMapper; + private PluginDefineMapper pluginDefineMapper; @Test public void testQueryAllPluginDefineList() { @@ -58,10 +48,10 @@ public class PluginDefineTest { @Test public void testQueryByNameAndType() { PluginDefine pluginDefine = createPluginDefine(); - List pluginDefines = pluginDefineMapper.queryByNameAndType(pluginDefine.getPluginName(), pluginDefine.getPluginType()); - Assert.assertTrue(pluginDefines.size() > 0); - Assert.assertEquals(pluginDefines.get(0).getPluginType(), pluginDefine.getPluginType()); - Assert.assertEquals(pluginDefines.get(0).getPluginName(), pluginDefine.getPluginName()); + PluginDefine pluginDefineSaved = pluginDefineMapper.queryByNameAndType(pluginDefine.getPluginName(), pluginDefine.getPluginType()); + Assert.assertNotNull(pluginDefineSaved); + Assert.assertEquals(pluginDefineSaved.getPluginType(), pluginDefine.getPluginType()); + Assert.assertEquals(pluginDefineSaved.getPluginName(), pluginDefine.getPluginName()); } /** diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/ProcessDefinitionDaoTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/ProcessDefinitionDaoTest.java index 43aba5a495..9d757b208f 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/ProcessDefinitionDaoTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/ProcessDefinitionDaoTest.java @@ -17,17 +17,18 @@ package org.apache.dolphinscheduler.dao.upgrade; -import static org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.getDataSource; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; +import javax.sql.DataSource; import java.util.HashMap; import java.util.Map; -import javax.sql.DataSource; - -import org.junit.Test; - +@ActiveProfiles("h2") public class ProcessDefinitionDaoTest { - final DataSource dataSource = getDataSource(); + @Autowired + private DataSource dataSource; final ProcessDefinitionDao processDefinitionDao = new ProcessDefinitionDao(); @Test diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/WorkerGroupDaoTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/WorkerGroupDaoTest.java index 7eed867248..ca6ed2f547 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/WorkerGroupDaoTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/WorkerGroupDaoTest.java @@ -16,19 +16,24 @@ */ package org.apache.dolphinscheduler.dao.upgrade; -import static org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.getDataSource; - -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.Assert.assertThat; - -import java.util.Map; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import javax.sql.DataSource; +import java.util.Map; -import org.junit.Test; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.junit.Assert.assertThat; public class WorkerGroupDaoTest { - protected final DataSource dataSource = getDataSource(); + @Autowired + protected DataSource dataSource; + + @BeforeClass + public static void setupClass() { + System.setProperty("spring.profiles.active", "h2"); + } @Test public void testQueryQueryAllOldWorkerGroup() throws Exception { diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml new file mode 100644 index 0000000000..f779924fc4 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml @@ -0,0 +1,60 @@ + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-all + + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-clickhouse + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-db2 + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-hive + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-mysql + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-oracle + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-postgresql + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-sqlserver + + + diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml new file mode 100644 index 0000000000..dc2dd2026f --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/pom.xml @@ -0,0 +1,153 @@ + + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-api + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + provided + + + + commons-io + commons-io + provided + + + + org.slf4j + slf4j-api + provided + + + + com.google.guava + guava + + + + commons-codec + commons-codec + + + + org.apache.commons + commons-collections4 + provided + + + + com.github.oshi + oshi-core + provided + + + + org.springframework + spring-jdbc + + + + org.apache.hadoop + hadoop-client + + + org.slf4j + slf4j-log4j12 + + + servlet-api + javax.servlet + + + org.codehaus.jackson + jackson-jaxrs + + + org.codehaus.jackson + jackson-xc + + + + org.fusesource.leveldbjni + leveldbjni-all + + + org.apache.zookeeper + zookeeper + + + org.apache.hadoop + hadoop-mapreduce-client-shuffle + + + jersey-client + com.sun.jersey + + + jersey-core + com.sun.jersey + + + jaxb-api + javax.xml.bind + + + log4j + log4j + + + provided + + + org.mockito + mockito-core + jar + test + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + com.zaxxer + HikariCP + + + diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java new file mode 100644 index 0000000000..e1a5149999 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java @@ -0,0 +1,128 @@ +/* + * 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.dolphinscheduler.plugin.datasource.api.client; + +import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; +import org.apache.dolphinscheduler.spi.utils.StringUtils; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.concurrent.TimeUnit; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.JdbcTemplate; + +import com.google.common.base.Stopwatch; + +public class CommonDataSourceClient implements DataSourceClient { + + private static final Logger logger = LoggerFactory.getLogger(CommonDataSourceClient.class); + + public static final String COMMON_USER = "root"; + public static final String COMMON_PASSWORD = "123456"; + public static final String COMMON_VALIDATION_QUERY = "select 1"; + + protected final BaseConnectionParam baseConnectionParam; + protected DataSource dataSource; + protected JdbcTemplate jdbcTemplate; + + public CommonDataSourceClient(BaseConnectionParam baseConnectionParam) { + this.baseConnectionParam = baseConnectionParam; + preInit(); + checkEnv(baseConnectionParam); + initClient(baseConnectionParam); + checkClient(); + } + + protected void preInit() { + logger.info("preInit in CommonDataSourceClient"); + } + + protected void checkEnv(BaseConnectionParam baseConnectionParam) { + checkValidationQuery(baseConnectionParam); + checkUser(baseConnectionParam); + } + + protected void initClient(BaseConnectionParam baseConnectionParam) { + this.dataSource = JdbcDataSourceProvider.createJdbcDataSource(baseConnectionParam); + this.jdbcTemplate = new JdbcTemplate(dataSource); + } + + protected void checkUser(BaseConnectionParam baseConnectionParam) { + if (StringUtils.isBlank(baseConnectionParam.getUser())) { + setDefaultUsername(baseConnectionParam); + } + if (StringUtils.isBlank(baseConnectionParam.getPassword())) { + setDefaultPassword(baseConnectionParam); + } + } + + protected void setDefaultUsername(BaseConnectionParam baseConnectionParam) { + baseConnectionParam.setUser(COMMON_USER); + } + + protected void setDefaultPassword(BaseConnectionParam baseConnectionParam) { + baseConnectionParam.setPassword(COMMON_PASSWORD); + } + + protected void checkValidationQuery(BaseConnectionParam baseConnectionParam) { + if (StringUtils.isBlank(baseConnectionParam.getValidationQuery())) { + setDefaultValidationQuery(baseConnectionParam); + } + } + + protected void setDefaultValidationQuery(BaseConnectionParam baseConnectionParam) { + baseConnectionParam.setValidationQuery(COMMON_VALIDATION_QUERY); + } + + @Override + public void checkClient() { + //Checking data source client + Stopwatch stopwatch = Stopwatch.createStarted(); + try { + this.jdbcTemplate.execute(this.baseConnectionParam.getValidationQuery()); + } catch (Exception e) { + throw new RuntimeException("JDBC connect failed", e); + } finally { + logger.info("Time to execute check jdbc client with sql {} for {} ms ", this.baseConnectionParam.getValidationQuery(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); + } + } + + @Override + public Connection getConnection() { + try { + return this.dataSource.getConnection(); + } catch (SQLException e) { + logger.error("get druidDataSource Connection fail SQLException: {}", e.getMessage(), e); + return null; + } + } + + @Override + public void close() { + logger.info("do close dataSource."); + this.dataSource = null; + this.jdbcTemplate = null; + } + +} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDatasourceProcessor.java similarity index 81% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDatasourceProcessor.java index a9d3bcef36..30ac9ead62 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/AbstractDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDatasourceProcessor.java @@ -15,10 +15,15 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource; + +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.collections4.MapUtils; +import java.text.MessageFormat; import java.util.Map; import java.util.regex.Pattern; @@ -76,4 +81,9 @@ public abstract class AbstractDatasourceProcessor implements DatasourceProcessor } } + @Override + public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) { + BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam; + return MessageFormat.format("{0}@{1}@{2}", dbType.getDescp(), baseConnectionParam.getUser(), baseConnectionParam.getJdbcUrl()); + } } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseDataSourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java similarity index 79% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseDataSourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java index 8bc3f94379..d6d6cab32f 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseDataSourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java @@ -15,18 +15,18 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; - -import org.apache.dolphinscheduler.common.datasource.clickhouse.ClickHouseDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.db2.Db2DatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.hive.HiveDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.oracle.OracleDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.postgresql.PostgreSqlDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.presto.PrestoDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.spark.SparkDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.sqlserver.SqlServerDatasourceParamDTO; -import org.apache.dolphinscheduler.common.enums.DbType; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerDatasourceParamDTO; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.io.Serializable; import java.util.Map; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsConnectionParam.java similarity index 92% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsConnectionParam.java index 908b7c8cef..b5fc59b511 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseHdfsConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsConnectionParam.java @@ -15,7 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource; + +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class BaseHdfsConnectionParam extends BaseConnectionParam { protected String principal; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsDatasourceParamDTO.java similarity index 96% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsDatasourceParamDTO.java index 0cfa3cb434..aaa1892b88 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsDatasourceParamDTO.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource; public abstract class BaseHdfsDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DatasourceProcessor.java similarity index 87% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DatasourceProcessor.java index b0243a4f72..63c434c916 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DatasourceProcessor.java @@ -15,8 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import java.io.IOException; @@ -30,6 +31,12 @@ public interface DatasourceProcessor { */ void checkDatasourceParam(BaseDataSourceParamDTO datasourceParam); + /** + * get Datasource Client UniqueId + * @return UniqueId + */ + String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType); + /** * create BaseDataSourceParamDTO by connectionJson * @@ -58,6 +65,11 @@ public interface DatasourceProcessor { */ String getDatasourceDriver(); + /** + * get validation Query + */ + String getValidationQuery(); + /** * get jdbcUrl by connection param, the jdbcUrl is different with ConnectionParam.jdbcUrl, this method will inject * other to jdbcUrl diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceParamDTO.java index 0cdb20fdfe..7938204aac 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.clickhouse; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class ClickHouseDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessor.java similarity index 80% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessor.java index 81611a3e12..330967b2b8 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessor.java @@ -15,18 +15,18 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.clickhouse; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.StringUtils; import java.sql.Connection; import java.sql.DriverManager; @@ -64,8 +64,11 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor { clickhouseConnectionParam.setAddress(address); clickhouseConnectionParam.setJdbcUrl(jdbcUrl); clickhouseConnectionParam.setUser(clickHouseParam.getUserName()); - clickhouseConnectionParam.setPassword(CommonUtils.encodePassword(clickHouseParam.getPassword())); + clickhouseConnectionParam.setPassword(PasswordUtils.encodePassword(clickHouseParam.getPassword())); + clickhouseConnectionParam.setDriverClassName(getDatasourceDriver()); + clickhouseConnectionParam.setValidationQuery(getValidationQuery()); clickhouseConnectionParam.setOther(transformOther(clickHouseParam.getOther())); + clickhouseConnectionParam.setProps(clickHouseParam.getOther()); return clickhouseConnectionParam; } @@ -79,6 +82,11 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.COM_CLICKHOUSE_JDBC_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.CLICKHOUSE_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; @@ -94,7 +102,7 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor { ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(clickhouseConnectionParam), - clickhouseConnectionParam.getUser(), CommonUtils.decodePassword(clickhouseConnectionParam.getPassword())); + clickhouseConnectionParam.getUser(), PasswordUtils.decodePassword(clickhouseConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickhouseConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickhouseConnectionParam.java similarity index 78% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickhouseConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickhouseConnectionParam.java index d2fdd0a333..5049cf6253 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickhouseConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickhouseConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.clickhouse; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class ClickhouseConnectionParam extends BaseConnectionParam { @Override @@ -28,6 +28,9 @@ public class ClickhouseConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2ConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2ConnectionParam.java similarity index 78% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2ConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2ConnectionParam.java index bb47ec2aea..c77b3a78ca 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2ConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2ConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.db2; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class Db2ConnectionParam extends BaseConnectionParam { @Override @@ -28,6 +28,9 @@ public class Db2ConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceParamDTO.java index b5476a525e..a0adfd4fd3 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.db2; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class Db2DatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessor.java similarity index 79% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessor.java index 4bad7f6061..d9b6f8d277 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessor.java @@ -15,19 +15,19 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.db2; - -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.StringUtils; import java.sql.Connection; import java.sql.DriverManager; @@ -65,8 +65,11 @@ public class Db2DatasourceProcessor extends AbstractDatasourceProcessor { db2ConnectionParam.setDatabase(db2Param.getDatabase()); db2ConnectionParam.setJdbcUrl(jdbcUrl); db2ConnectionParam.setUser(db2Param.getUserName()); - db2ConnectionParam.setPassword(CommonUtils.encodePassword(db2Param.getPassword())); + db2ConnectionParam.setPassword(PasswordUtils.encodePassword(db2Param.getPassword())); + db2ConnectionParam.setDriverClassName(getDatasourceDriver()); + db2ConnectionParam.setValidationQuery(getValidationQuery()); db2ConnectionParam.setOther(transformOther(db2Param.getOther())); + db2ConnectionParam.setProps(db2Param.getOther()); return db2ConnectionParam; } @@ -95,7 +98,7 @@ public class Db2DatasourceProcessor extends AbstractDatasourceProcessor { Db2ConnectionParam db2ConnectionParam = (Db2ConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(db2ConnectionParam), - db2ConnectionParam.getUser(), CommonUtils.decodePassword(db2ConnectionParam.getPassword())); + db2ConnectionParam.getUser(), PasswordUtils.decodePassword(db2ConnectionParam.getPassword())); } @Override @@ -103,6 +106,11 @@ public class Db2DatasourceProcessor extends AbstractDatasourceProcessor { return DbType.DB2; } + @Override + public String getValidationQuery() { + return Constants.DB2_VALIDATION_QUERY; + } + private String transformOther(Map otherMap) { if (MapUtils.isEmpty(otherMap)) { return null; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveConnectionParam.java similarity index 81% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveConnectionParam.java index 006f12917b..0b1ce52349 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.hive; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseHdfsConnectionParam; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsConnectionParam; public class HiveConnectionParam extends BaseHdfsConnectionParam { @Override @@ -28,6 +28,9 @@ public class HiveConnectionParam extends BaseHdfsConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + ", principal='" + principal + '\'' + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDataSourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceParamDTO.java similarity index 90% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDataSourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceParamDTO.java index 678f866b19..4aaceaae23 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDataSourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.hive; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseHdfsDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsDatasourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class HiveDataSourceParamDTO extends BaseHdfsDatasourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessor.java similarity index 83% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessor.java index 8113e59e39..2f7c7afd7f 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessor.java @@ -15,20 +15,20 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.hive; - -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.HiveConfUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.sql.Connection; @@ -83,7 +83,9 @@ public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { hiveConnectionParam.setAddress(address.toString()); hiveConnectionParam.setJdbcUrl(jdbcUrl); hiveConnectionParam.setUser(hiveParam.getUserName()); - hiveConnectionParam.setPassword(CommonUtils.encodePassword(hiveParam.getPassword())); + hiveConnectionParam.setPassword(PasswordUtils.encodePassword(hiveParam.getPassword())); + hiveConnectionParam.setDriverClassName(getDatasourceDriver()); + hiveConnectionParam.setValidationQuery(getValidationQuery()); if (CommonUtils.getKerberosStartupState()) { hiveConnectionParam.setPrincipal(hiveParam.getPrincipal()); @@ -92,6 +94,7 @@ public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { hiveConnectionParam.setLoginUserKeytabUsername(hiveParam.getLoginUserKeytabUsername()); } hiveConnectionParam.setOther(transformOther(hiveParam.getOther())); + hiveConnectionParam.setProps(hiveParam.getOther()); return hiveConnectionParam; } @@ -105,6 +108,11 @@ public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.HIVE_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { HiveConnectionParam hiveConnectionParam = (HiveConnectionParam) connectionParam; @@ -123,7 +131,7 @@ public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { hiveConnectionParam.getLoginUserKeytabUsername(), hiveConnectionParam.getLoginUserKeytabPath()); Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(connectionParam), - hiveConnectionParam.getUser(), CommonUtils.decodePassword(hiveConnectionParam.getPassword())); + hiveConnectionParam.getUser(), PasswordUtils.decodePassword(hiveConnectionParam.getPassword())); } @Override @@ -152,11 +160,7 @@ public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { String[] otherArray = otherParams.split(";", -1); for (String conf : otherArray) { - if (HiveConfUtils.isHiveConfVar(conf)) { - hiveConfListSb.append(conf).append(";"); - } else { - sessionVarListSb.append(conf).append(";"); - } + sessionVarListSb.append(conf).append(";"); } // remove the last ";" diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlConnectionParam.java similarity index 78% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlConnectionParam.java index ea7a574db5..c86af3b915 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlConnectionParam.java @@ -15,12 +15,11 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.mysql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class MysqlConnectionParam extends BaseConnectionParam { - @Override public String toString() { return "MysqlConnectionParam{" @@ -29,6 +28,9 @@ public class MysqlConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceParamDTO.java index 3bcb84bd60..25d5a95acd 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.mysql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class MysqlDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessor.java similarity index 83% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessor.java index 564ed3dfc2..9624cbc44e 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessor.java @@ -15,19 +15,19 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.mysql; - -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.StringUtils; import java.sql.Connection; import java.sql.DriverManager; @@ -82,8 +82,11 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor { mysqlConnectionParam.setDatabase(mysqlDatasourceParam.getDatabase()); mysqlConnectionParam.setAddress(address); mysqlConnectionParam.setUser(mysqlDatasourceParam.getUserName()); - mysqlConnectionParam.setPassword(CommonUtils.encodePassword(mysqlDatasourceParam.getPassword())); + mysqlConnectionParam.setPassword(PasswordUtils.encodePassword(mysqlDatasourceParam.getPassword())); + mysqlConnectionParam.setDriverClassName(getDatasourceDriver()); + mysqlConnectionParam.setValidationQuery(getValidationQuery()); mysqlConnectionParam.setOther(transformOther(mysqlDatasourceParam.getOther())); + mysqlConnectionParam.setProps(mysqlDatasourceParam.getOther()); return mysqlConnectionParam; } @@ -95,7 +98,12 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor { @Override public String getDatasourceDriver() { - return Constants.COM_MYSQL_JDBC_DRIVER; + return Constants.COM_MYSQL_CJ_JDBC_DRIVER; + } + + @Override + public String getValidationQuery() { + return Constants.MYSQL_VALIDATION_QUERY; } @Override @@ -117,7 +125,7 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor { logger.warn("sensitive param : {} in username field is filtered", AUTO_DESERIALIZE); user = user.replace(AUTO_DESERIALIZE, ""); } - String password = CommonUtils.decodePassword(mysqlConnectionParam.getPassword()); + String password = PasswordUtils.decodePassword(mysqlConnectionParam.getPassword()); if (password.contains(AUTO_DESERIALIZE)) { logger.warn("sensitive param : {} in password field is filtered", AUTO_DESERIALIZE); password = password.replace(AUTO_DESERIALIZE, ""); diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleConnectionParam.java similarity index 82% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleConnectionParam.java index 45c7ae14de..9984174042 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleConnectionParam.java @@ -15,13 +15,12 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.oracle; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbConnectType; public class OracleConnectionParam extends BaseConnectionParam { - protected DbConnectType connectType; public DbConnectType getConnectType() { @@ -40,6 +39,9 @@ public class OracleConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + ", connectType=" + connectType + '}'; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceParamDTO.java similarity index 91% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceParamDTO.java index 502a893579..b027266cf3 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.oracle; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbConnectType; import org.apache.dolphinscheduler.spi.enums.DbType; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessor.java similarity index 81% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessor.java index 4ec7e19bb6..20a4da6344 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessor.java @@ -15,17 +15,17 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.oracle; - -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbConnectType; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbConnectType; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang.StringUtils; @@ -76,12 +76,15 @@ public class OracleDatasourceProcessor extends AbstractDatasourceProcessor { OracleConnectionParam oracleConnectionParam = new OracleConnectionParam(); oracleConnectionParam.setUser(oracleParam.getUserName()); - oracleConnectionParam.setPassword(CommonUtils.encodePassword(oracleParam.getPassword())); + oracleConnectionParam.setPassword(PasswordUtils.encodePassword(oracleParam.getPassword())); oracleConnectionParam.setAddress(address); oracleConnectionParam.setJdbcUrl(jdbcUrl); oracleConnectionParam.setDatabase(oracleParam.getDatabase()); oracleConnectionParam.setConnectType(oracleParam.getConnectType()); + oracleConnectionParam.setDriverClassName(getDatasourceDriver()); + oracleConnectionParam.setValidationQuery(getValidationQuery()); oracleConnectionParam.setOther(transformOther(oracleParam.getOther())); + oracleConnectionParam.setProps(oracleParam.getOther()); return oracleConnectionParam; } @@ -96,6 +99,11 @@ public class OracleDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.COM_ORACLE_JDBC_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.ORACLE_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { OracleConnectionParam oracleConnectionParam = (OracleConnectionParam) connectionParam; @@ -110,7 +118,7 @@ public class OracleDatasourceProcessor extends AbstractDatasourceProcessor { OracleConnectionParam oracleConnectionParam = (OracleConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(connectionParam), - oracleConnectionParam.getUser(), CommonUtils.decodePassword(oracleConnectionParam.getPassword())); + oracleConnectionParam.getUser(), PasswordUtils.decodePassword(oracleConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlConnectionParam.java similarity index 78% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlConnectionParam.java index 7090581f65..e2e3dc0a29 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.postgresql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class PostgreSqlConnectionParam extends BaseConnectionParam { @Override @@ -28,6 +28,9 @@ public class PostgreSqlConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceParamDTO.java index ef1ec9eda4..b17f8380be 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.postgresql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class PostgreSqlDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessor.java similarity index 80% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessor.java index e7939630a4..749c6b5944 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessor.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.postgresql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang.StringUtils; @@ -65,8 +65,11 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor { postgreSqlConnectionParam.setAddress(address); postgreSqlConnectionParam.setDatabase(postgreSqlParam.getDatabase()); postgreSqlConnectionParam.setUser(postgreSqlParam.getUserName()); - postgreSqlConnectionParam.setPassword(CommonUtils.encodePassword(postgreSqlParam.getPassword())); + postgreSqlConnectionParam.setPassword(PasswordUtils.encodePassword(postgreSqlParam.getPassword())); + postgreSqlConnectionParam.setDriverClassName(getDatasourceDriver()); + postgreSqlConnectionParam.setValidationQuery(getValidationQuery()); postgreSqlConnectionParam.setOther(transformOther(postgreSqlParam.getOther())); + postgreSqlConnectionParam.setProps(postgreSqlParam.getOther()); return postgreSqlConnectionParam; } @@ -81,6 +84,11 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.ORG_POSTGRESQL_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.POSTGRESQL_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; @@ -95,7 +103,7 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor { PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(postgreSqlConnectionParam), - postgreSqlConnectionParam.getUser(), CommonUtils.decodePassword(postgreSqlConnectionParam.getPassword())); + postgreSqlConnectionParam.getUser(), PasswordUtils.decodePassword(postgreSqlConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoConnectionParam.java similarity index 78% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoConnectionParam.java index 436bc6dd1e..fcdd17eaaa 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.presto; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class PrestoConnectionParam extends BaseConnectionParam { @Override @@ -28,6 +28,9 @@ public class PrestoConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceParamDTO.java index b592e217c2..50e65b5b55 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.presto; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class PrestoDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessor.java similarity index 80% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessor.java index 25dab29a68..b9fbc33b02 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessor.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.presto; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang.StringUtils; @@ -64,11 +64,14 @@ public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor { PrestoConnectionParam prestoConnectionParam = new PrestoConnectionParam(); prestoConnectionParam.setUser(prestoParam.getUserName()); - prestoConnectionParam.setPassword(CommonUtils.encodePassword(prestoParam.getPassword())); + prestoConnectionParam.setPassword(PasswordUtils.encodePassword(prestoParam.getPassword())); prestoConnectionParam.setOther(transformOther(prestoParam.getOther())); prestoConnectionParam.setAddress(address); prestoConnectionParam.setJdbcUrl(jdbcUrl); prestoConnectionParam.setDatabase(prestoParam.getDatabase()); + prestoConnectionParam.setDriverClassName(getDatasourceDriver()); + prestoConnectionParam.setValidationQuery(getValidationQuery()); + prestoConnectionParam.setProps(prestoParam.getOther()); return prestoConnectionParam; } @@ -83,6 +86,11 @@ public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.COM_PRESTO_JDBC_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.PRESTO_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { PrestoConnectionParam prestoConnectionParam = (PrestoConnectionParam) connectionParam; @@ -97,7 +105,7 @@ public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor { PrestoConnectionParam prestoConnectionParam = (PrestoConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(connectionParam), - prestoConnectionParam.getUser(), CommonUtils.decodePassword(prestoConnectionParam.getPassword())); + prestoConnectionParam.getUser(), PasswordUtils.decodePassword(prestoConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkConnectionParam.java similarity index 81% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkConnectionParam.java index 725d7b8e2b..bd1bb9e025 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.spark; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; -import org.apache.dolphinscheduler.common.datasource.BaseHdfsConnectionParam; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsConnectionParam; public class SparkConnectionParam extends BaseHdfsConnectionParam { @Override @@ -28,6 +28,9 @@ public class SparkConnectionParam extends BaseHdfsConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + ", principal='" + principal + '\'' + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceParamDTO.java similarity index 90% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceParamDTO.java index 144fae5a1f..82e1f1124f 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.spark; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseHdfsDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsDatasourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class SparkDatasourceParamDTO extends BaseHdfsDatasourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessor.java similarity index 82% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessor.java index 7c7d021056..376399d778 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessor.java @@ -15,19 +15,20 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.spark; - -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.sql.Connection; @@ -81,12 +82,16 @@ public class SparkDatasourceProcessor extends AbstractDatasourceProcessor { } SparkConnectionParam sparkConnectionParam = new SparkConnectionParam(); - sparkConnectionParam.setPassword(CommonUtils.encodePassword(sparkDatasourceParam.getPassword())); + sparkConnectionParam.setPassword(PasswordUtils.encodePassword(sparkDatasourceParam.getPassword())); sparkConnectionParam.setUser(sparkDatasourceParam.getUserName()); sparkConnectionParam.setOther(transformOther(sparkDatasourceParam.getOther())); sparkConnectionParam.setDatabase(sparkDatasourceParam.getDatabase()); sparkConnectionParam.setAddress(address.toString()); sparkConnectionParam.setJdbcUrl(jdbcUrl); + sparkConnectionParam.setDriverClassName(getDatasourceDriver()); + sparkConnectionParam.setValidationQuery(getValidationQuery()); + sparkConnectionParam.setProps(sparkDatasourceParam.getOther()); + if (CommonUtils.getKerberosStartupState()) { sparkConnectionParam.setPrincipal(sparkDatasourceParam.getPrincipal()); sparkConnectionParam.setJavaSecurityKrb5Conf(sparkDatasourceParam.getJavaSecurityKrb5Conf()); @@ -107,6 +112,11 @@ public class SparkDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.HIVE_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { SparkConnectionParam sparkConnectionParam = (SparkConnectionParam) connectionParam; @@ -123,7 +133,7 @@ public class SparkDatasourceProcessor extends AbstractDatasourceProcessor { sparkConnectionParam.getLoginUserKeytabUsername(), sparkConnectionParam.getLoginUserKeytabPath()); Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(sparkConnectionParam), - sparkConnectionParam.getUser(), CommonUtils.decodePassword(sparkConnectionParam.getPassword())); + sparkConnectionParam.getUser(), PasswordUtils.decodePassword(sparkConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerConnectionParam.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerConnectionParam.java similarity index 78% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerConnectionParam.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerConnectionParam.java index ff5225771a..d362c241aa 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerConnectionParam.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerConnectionParam.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.sqlserver; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; public class SqlServerConnectionParam extends BaseConnectionParam { @Override @@ -28,6 +28,9 @@ public class SqlServerConnectionParam extends BaseConnectionParam { + ", address='" + address + '\'' + ", database='" + database + '\'' + ", jdbcUrl='" + jdbcUrl + '\'' + + ", driverLocation='" + driverLocation + '\'' + + ", driverClassName='" + driverClassName + '\'' + + ", validationQuery='" + validationQuery + '\'' + ", other='" + other + '\'' + '}'; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceParamDTO.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceParamDTO.java similarity index 89% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceParamDTO.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceParamDTO.java index 101ab2aa9f..b90bb8820b 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceParamDTO.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceParamDTO.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource.sqlserver; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.spi.enums.DbType; public class SqlServerDatasourceParamDTO extends BaseDataSourceParamDTO { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessor.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessor.java similarity index 80% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessor.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessor.java index 32fca091f1..c4c2d9fec1 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessor.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessor.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.sqlserver; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.ConnectionParam; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang.StringUtils; @@ -64,7 +64,10 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor { sqlServerConnectionParam.setJdbcUrl(jdbcUrl); sqlServerConnectionParam.setOther(transformOther(sqlServerParam.getOther())); sqlServerConnectionParam.setUser(sqlServerParam.getUserName()); - sqlServerConnectionParam.setPassword(CommonUtils.encodePassword(sqlServerParam.getPassword())); + sqlServerConnectionParam.setPassword(PasswordUtils.encodePassword(sqlServerParam.getPassword())); + sqlServerConnectionParam.setDriverClassName(getDatasourceDriver()); + sqlServerConnectionParam.setValidationQuery(getValidationQuery()); + sqlServerConnectionParam.setProps(sqlServerParam.getOther()); return sqlServerConnectionParam; } @@ -78,6 +81,11 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor { return Constants.COM_SQLSERVER_JDBC_DRIVER; } + @Override + public String getValidationQuery() { + return Constants.SQLSERVER_VALIDATION_QUERY; + } + @Override public String getJdbcUrl(ConnectionParam connectionParam) { SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; @@ -93,7 +101,7 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor { SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; Class.forName(getDatasourceDriver()); return DriverManager.getConnection(getJdbcUrl(connectionParam), sqlServerConnectionParam.getUser(), - CommonUtils.decodePassword(sqlServerConnectionParam.getPassword())); + PasswordUtils.decodePassword(sqlServerConnectionParam.getPassword())); } @Override diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.java new file mode 100644 index 0000000000..2165e214fd --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.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.dolphinscheduler.plugin.datasource.api.plugin; + +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; +import org.apache.dolphinscheduler.spi.enums.DbType; + +import java.sql.Connection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataSourceClientProvider { + private static final Logger logger = LoggerFactory.getLogger(DataSourceClientProvider.class); + + private static final Map uniqueId2dataSourceClientMap = new ConcurrentHashMap<>(); + + private DataSourcePluginManager dataSourcePluginManager; + + private DataSourceClientProvider() { + initDataSourcePlugin(); + } + + private static class DataSourceClientProviderHolder { + private static final DataSourceClientProvider INSTANCE = new DataSourceClientProvider(); + } + + public static DataSourceClientProvider getInstance() { + return DataSourceClientProviderHolder.INSTANCE; + } + + public Connection getConnection(DbType dbType, ConnectionParam connectionParam) { + BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam; + String datasourceUniqueId = DatasourceUtil.getDatasourceUniqueId(baseConnectionParam, dbType); + logger.info("getConnection datasourceUniqueId {}", datasourceUniqueId); + + DataSourceClient dataSourceClient = uniqueId2dataSourceClientMap.computeIfAbsent(datasourceUniqueId, $ -> { + Map dataSourceChannelMap = dataSourcePluginManager.getDataSourceChannelMap(); + DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getDescp()); + if (null == dataSourceChannel) { + throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getDescp())); + } + return dataSourceChannel.createDataSourceClient(baseConnectionParam); + }); + return dataSourceClient.getConnection(); + } + + private void initDataSourcePlugin() { + dataSourcePluginManager = new DataSourcePluginManager(); + dataSourcePluginManager.installPlugin(); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourcePluginManager.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourcePluginManager.java new file mode 100644 index 0000000000..27a2ea8e40 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourcePluginManager.java @@ -0,0 +1,66 @@ +/* + * 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.dolphinscheduler.plugin.datasource.api.plugin; + +import static java.lang.String.format; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataSourcePluginManager { + private static final Logger logger = LoggerFactory.getLogger(DataSourcePluginManager.class); + + private final Map datasourceClientMap = new ConcurrentHashMap<>(); + + public Map getDataSourceChannelMap() { + return Collections.unmodifiableMap(datasourceClientMap); + } + + public void installPlugin() { + final Set names = new HashSet<>(); + + ServiceLoader.load(DataSourceChannelFactory.class).forEach(factory -> { + final String name = factory.getName(); + + logger.info("Registering datasource plugin: {}", name); + + if (!names.add(name)) { + throw new IllegalStateException(format("Duplicate datasource plugins named '%s'", name)); + } + + loadDatasourceClient(factory); + + logger.info("Registered datasource plugin: {}", name); + }); + } + + private void loadDatasourceClient(DataSourceChannelFactory datasourceChannelFactory) { + DataSourceChannel datasourceChannel = datasourceChannelFactory.create(); + datasourceClientMap.put(datasourceChannelFactory.getName(), datasourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java new file mode 100644 index 0000000000..b4a37fecfc --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java @@ -0,0 +1,83 @@ +/* + * 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.dolphinscheduler.plugin.datasource.api.provider; + +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.zaxxer.hikari.HikariDataSource; + +/** + * Jdbc Data Source Provider + */ +public class JdbcDataSourceProvider { + + private static final Logger logger = LoggerFactory.getLogger(JdbcDataSourceProvider.class); + + public static HikariDataSource createJdbcDataSource(BaseConnectionParam properties) { + logger.info("Creating HikariDataSource pool for maxActive:{}", PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); + HikariDataSource dataSource = new HikariDataSource(); + + dataSource.setDriverClassName(properties.getDriverClassName()); + dataSource.setJdbcUrl(properties.getJdbcUrl()); + dataSource.setUsername(properties.getUser()); + dataSource.setPassword(PasswordUtils.decodePassword(properties.getPassword())); + + dataSource.setMinimumIdle(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MIN_IDLE, 5)); + dataSource.setMaximumPoolSize(PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); + dataSource.setConnectionTestQuery(properties.getValidationQuery()); + + if (properties.getProps() != null) { + properties.getProps().forEach(dataSource::addDataSourceProperty); + } + + logger.info("Creating HikariDataSource pool success."); + return dataSource; + } + + /** + * @return One Session Jdbc DataSource + */ + public static HikariDataSource createOneSessionJdbcDataSource(BaseConnectionParam properties) { + logger.info("Creating OneSession HikariDataSource pool for maxActive:{}", PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); + + HikariDataSource dataSource = new HikariDataSource(); + + dataSource.setDriverClassName(properties.getDriverClassName()); + dataSource.setJdbcUrl(properties.getJdbcUrl()); + dataSource.setUsername(properties.getUser()); + dataSource.setPassword(PasswordUtils.decodePassword(properties.getPassword())); + + dataSource.setMinimumIdle(1); + dataSource.setMaximumPoolSize(1); + dataSource.setConnectionTestQuery(properties.getValidationQuery()); + + if (properties.getProps() != null) { + properties.getProps().forEach(dataSource::addDataSourceProperty); + } + + logger.info("Creating OneSession HikariDataSource pool success."); + return dataSource; + } + +} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/CommonUtils.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtils.java similarity index 96% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/CommonUtils.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtils.java index 0c771389bd..25b6a59d46 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/util/CommonUtils.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.util; +package org.apache.dolphinscheduler.plugin.datasource.api.utils; import static org.apache.dolphinscheduler.spi.task.TaskConstants.HADOOP_SECURITY_AUTHENTICATION; import static org.apache.dolphinscheduler.spi.task.TaskConstants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE; @@ -41,8 +41,6 @@ import java.io.IOException; */ public class CommonUtils { - public static final String resourceUploadPath = PropertyUtils.getString(TaskConstants.RESOURCE_UPLOAD_PATH, "/dolphinscheduler"); - private CommonUtils() { throw new UnsupportedOperationException("Construct CommonUtils"); } @@ -130,6 +128,7 @@ public class CommonUtils { * @return data hdfs path */ public static String getHdfsDataBasePath() { + String resourceUploadPath = PropertyUtils.getString(TaskConstants.RESOURCE_UPLOAD_PATH, "/dolphinscheduler"); if ("/".equals(resourceUploadPath)) { // if basepath is configured to /, the generated url may be //default/resources (with extra leading /) return ""; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtil.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtil.java similarity index 73% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtil.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtil.java index 45dcece4ac..19dd7a7555 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtil.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtil.java @@ -15,20 +15,21 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; - -import org.apache.dolphinscheduler.common.datasource.clickhouse.ClickHouseDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.db2.Db2DatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.hive.HiveDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.oracle.OracleDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.postgresql.PostgreSqlDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.presto.PrestoDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.spark.SparkDatasourceProcessor; -import org.apache.dolphinscheduler.common.datasource.sqlserver.SqlServerDatasourceProcessor; -import org.apache.dolphinscheduler.common.enums.DbType; - -import java.sql.Connection; +package org.apache.dolphinscheduler.plugin.datasource.api.utils; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.DatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerDatasourceProcessor; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,14 +78,6 @@ public class DatasourceUtil { return getDatasourceProcessor(dbType).createConnectionParams(connectionJson); } - public static Connection getConnection(DbType dbType, ConnectionParam connectionParam) { - try { - return getDatasourceProcessor(dbType).getConnection(connectionParam); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - public static String getJdbcUrl(DbType dbType, ConnectionParam baseConnectionParam) { return getDatasourceProcessor(dbType).getJdbcUrl(baseConnectionParam); } @@ -118,4 +111,10 @@ public class DatasourceUtil { } } + /** + * get datasource UniqueId + */ + public static String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) { + return getDatasourceProcessor(dbType).getDatasourceUniqueId(connectionParam, dbType); + } } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/PasswordUtils.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/PasswordUtils.java similarity index 98% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/PasswordUtils.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/PasswordUtils.java index d71b7d04ee..9bf2f96735 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/PasswordUtils.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/PasswordUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.utils; import static org.apache.dolphinscheduler.spi.task.TaskConstants.DATASOURCE_ENCRYPTION_ENABLE; import static org.apache.dolphinscheduler.spi.task.TaskConstants.DATASOURCE_ENCRYPTION_SALT; diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.java new file mode 100644 index 0000000000..56c4327d1e --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.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.dolphinscheduler.plugin.datasource.api.client; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; +import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; + +import java.sql.Connection; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.jdbc.core.JdbcTemplate; + +import com.zaxxer.hikari.HikariDataSource; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest(value = {HikariDataSource.class, CommonDataSourceClient.class, JdbcDataSourceProvider.class, JdbcTemplate.class, Connection.class}) +public class CommonDataSourceClientTest { + + @Mock + private CommonDataSourceClient commonDataSourceClient; + + @Test + public void testPreInit() { + PowerMockito.doNothing().when(commonDataSourceClient).preInit(); + commonDataSourceClient.preInit(); + Mockito.verify(commonDataSourceClient).preInit(); + } + + @Test + public void testCheckEnv() { + BaseConnectionParam baseConnectionParam = new MysqlConnectionParam(); + PowerMockito.doNothing().when(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.checkEnv(baseConnectionParam); + Mockito.verify(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class)); + + PowerMockito.doNothing().when(commonDataSourceClient).checkValidationQuery(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.checkValidationQuery(baseConnectionParam); + Mockito.verify(commonDataSourceClient).checkValidationQuery(Mockito.any(BaseConnectionParam.class)); + + PowerMockito.doNothing().when(commonDataSourceClient).checkUser(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.checkUser(baseConnectionParam); + Mockito.verify(commonDataSourceClient).checkUser(Mockito.any(BaseConnectionParam.class)); + + PowerMockito.doNothing().when(commonDataSourceClient).setDefaultUsername(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.setDefaultUsername(baseConnectionParam); + Mockito.verify(commonDataSourceClient).setDefaultUsername(Mockito.any(BaseConnectionParam.class)); + + PowerMockito.doNothing().when(commonDataSourceClient).setDefaultPassword(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.setDefaultPassword(baseConnectionParam); + Mockito.verify(commonDataSourceClient).setDefaultPassword(Mockito.any(BaseConnectionParam.class)); + + } + + @Test + public void testInitClient() { + BaseConnectionParam baseConnectionParam = new MysqlConnectionParam(); + PowerMockito.doNothing().when(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class)); + commonDataSourceClient.initClient(baseConnectionParam); + Mockito.verify(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class)); + } + + @Test + public void testCheckClient() { + PowerMockito.doNothing().when(this.commonDataSourceClient).checkClient(); + this.commonDataSourceClient.checkClient(); + Mockito.verify(this.commonDataSourceClient).checkClient(); + } + + @Test + public void testGetConnection() { + Connection connection = PowerMockito.mock(Connection.class); + PowerMockito.when(commonDataSourceClient.getConnection()).thenReturn(connection); + Assert.assertNotNull(commonDataSourceClient.getConnection()); + } +} diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java similarity index 74% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java index 75c1f3c17d..106aa300a1 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java @@ -15,33 +15,46 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.clickhouse; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class ClickHouseDatasourceProcessorTest { private ClickHouseDatasourceProcessor clickHouseDatasourceProcessor = new ClickHouseDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); ClickHouseDatasourceParamDTO clickhouseConnectionParam = new ClickHouseDatasourceParamDTO(); clickhouseConnectionParam.setUserName("user"); clickhouseConnectionParam.setPassword("password"); clickhouseConnectionParam.setHost("localhost"); clickhouseConnectionParam.setPort(8123); clickhouseConnectionParam.setDatabase("default"); + clickhouseConnectionParam.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); ClickhouseConnectionParam connectionParams = (ClickhouseConnectionParam) clickHouseDatasourceProcessor .createConnectionParams(clickhouseConnectionParam); Assert.assertNotNull(connectionParams); @@ -80,4 +93,9 @@ public class ClickHouseDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.CLICKHOUSE, clickHouseDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.CLICKHOUSE_VALIDATION_QUERY, clickHouseDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessorTest.java similarity index 72% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessorTest.java index 21b1bc4663..7b405aae93 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/db2/Db2DatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessorTest.java @@ -15,33 +15,46 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.db2; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class Db2DatasourceProcessorTest { private Db2DatasourceProcessor db2DatasourceProcessor = new Db2DatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); Db2DatasourceParamDTO db2DatasourceParamDTO = new Db2DatasourceParamDTO(); db2DatasourceParamDTO.setUserName("root"); db2DatasourceParamDTO.setPassword("123456"); db2DatasourceParamDTO.setHost("localhost"); db2DatasourceParamDTO.setPort(5142); db2DatasourceParamDTO.setDatabase("default"); + db2DatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); Db2ConnectionParam connectionParams = (Db2ConnectionParam) db2DatasourceProcessor .createConnectionParams(db2DatasourceParamDTO); @@ -80,4 +93,8 @@ public class Db2DatasourceProcessorTest { Assert.assertEquals(DbType.DB2, db2DatasourceProcessor.getDbType()); } + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.DB2_VALIDATION_QUERY, db2DatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessorTest.java similarity index 68% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessorTest.java index 230b0855e5..84e8fd8898 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/hive/HiveDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessorTest.java @@ -15,36 +15,50 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.hive; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class HiveDatasourceProcessorTest { private HiveDatasourceProcessor hiveDatasourceProcessor = new HiveDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); HiveDataSourceParamDTO hiveDataSourceParamDTO = new HiveDataSourceParamDTO(); hiveDataSourceParamDTO.setHost("localhost1,localhost2"); hiveDataSourceParamDTO.setPort(5142); hiveDataSourceParamDTO.setUserName("default"); hiveDataSourceParamDTO.setDatabase("default"); + hiveDataSourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); + PowerMockito.mockStatic(CommonUtils.class); + PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(false); HiveConnectionParam connectionParams = (HiveConnectionParam) hiveDatasourceProcessor .createConnectionParams(hiveDataSourceParamDTO); - System.out.println(JSONUtils.toJsonString(connectionParams)); Assert.assertNotNull(connectionParams); Assert.assertEquals("jdbc:hive2://localhost1:5142,localhost2:5142", connectionParams.getAddress()); } @@ -76,4 +90,9 @@ public class HiveDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.HIVE, hiveDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.HIVE_VALIDATION_QUERY, hiveDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessorTest.java similarity index 63% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessorTest.java index 89bf4b15f1..f54b28d44d 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/mysql/MysqlDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessorTest.java @@ -15,38 +15,49 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.mysql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class MysqlDatasourceProcessorTest { private MysqlDatasourceProcessor mysqlDatasourceProcessor = new MysqlDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setPassword("123456"); mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setPort(3306); mysqlDatasourceParamDTO.setDatabase("default"); - + mysqlDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); MysqlConnectionParam connectionParams = (MysqlConnectionParam) mysqlDatasourceProcessor .createConnectionParams(mysqlDatasourceParamDTO); - System.out.println(JSONUtils.toJsonString(connectionParams)); Assert.assertEquals("jdbc:mysql://localhost:3306", connectionParams.getAddress()); Assert.assertEquals("jdbc:mysql://localhost:3306/default", connectionParams.getJdbcUrl()); } @@ -63,7 +74,7 @@ public class MysqlDatasourceProcessorTest { @Test public void testGetDatasourceDriver() { - Assert.assertEquals(Constants.COM_MYSQL_JDBC_DRIVER, mysqlDatasourceProcessor.getDatasourceDriver()); + Assert.assertEquals(Constants.COM_MYSQL_CJ_JDBC_DRIVER, mysqlDatasourceProcessor.getDatasourceDriver()); } @Test @@ -78,4 +89,17 @@ public class MysqlDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.MYSQL, mysqlDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.MYSQL_VALIDATION_QUERY, mysqlDatasourceProcessor.getValidationQuery()); + } + + @Test + public void testGetDatasourceUniqueId() { + MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); + mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3306/default"); + mysqlConnectionParam.setUser("root"); + Assert.assertEquals("mysql@root@jdbc:mysql://localhost:3306/default", mysqlDatasourceProcessor.getDatasourceUniqueId(mysqlConnectionParam, DbType.MYSQL)); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessorTest.java similarity index 72% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessorTest.java index 4f0fce2d9b..de88708810 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/oracle/OracleDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessorTest.java @@ -15,28 +15,38 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.oracle; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbConnectType; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbConnectType; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class OracleDatasourceProcessorTest { private OracleDatasourceProcessor oracleDatasourceProcessor = new OracleDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); OracleDatasourceParamDTO oracleDatasourceParamDTO = new OracleDatasourceParamDTO(); oracleDatasourceParamDTO.setConnectType(DbConnectType.ORACLE_SID); oracleDatasourceParamDTO.setHost("localhost"); @@ -44,7 +54,9 @@ public class OracleDatasourceProcessorTest { oracleDatasourceParamDTO.setUserName("root"); oracleDatasourceParamDTO.setPassword("123456"); oracleDatasourceParamDTO.setDatabase("default"); - + oracleDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); OracleConnectionParam connectionParams = (OracleConnectionParam) oracleDatasourceProcessor .createConnectionParams(oracleDatasourceParamDTO); Assert.assertNotNull(connectionParams); @@ -80,4 +92,9 @@ public class OracleDatasourceProcessorTest { public void getDbType() { Assert.assertEquals(DbType.ORACLE, oracleDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.ORACLE_VALIDATION_QUERY, oracleDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java similarity index 73% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java index 178c30ce7b..0555cbfa13 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java @@ -15,34 +15,46 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.postgresql; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class PostgreSqlDatasourceProcessorTest { private PostgreSqlDatasourceProcessor postgreSqlDatasourceProcessor = new PostgreSqlDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); PostgreSqlDatasourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSqlDatasourceParamDTO(); postgreSqlDatasourceParamDTO.setUserName("root"); postgreSqlDatasourceParamDTO.setPassword("123456"); postgreSqlDatasourceParamDTO.setHost("localhost"); postgreSqlDatasourceParamDTO.setPort(3308); postgreSqlDatasourceParamDTO.setDatabase("default"); - + postgreSqlDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PostgreSqlConnectionParam connectionParams = (PostgreSqlConnectionParam) postgreSqlDatasourceProcessor .createConnectionParams(postgreSqlDatasourceParamDTO); Assert.assertEquals("jdbc:postgresql://localhost:3308", connectionParams.getAddress()); @@ -80,4 +92,9 @@ public class PostgreSqlDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.POSTGRESQL, postgreSqlDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.POSTGRESQL_VALIDATION_QUERY, postgreSqlDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessorTest.java similarity index 72% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessorTest.java index a2bfe997bd..5145cd2e21 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/presto/PrestoDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessorTest.java @@ -15,34 +15,46 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.presto; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class PrestoDatasourceProcessorTest { private PrestoDatasourceProcessor prestoDatasourceProcessor = new PrestoDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); PrestoDatasourceParamDTO prestoDatasourceParamDTO = new PrestoDatasourceParamDTO(); prestoDatasourceParamDTO.setHost("localhost"); prestoDatasourceParamDTO.setPort(1234); prestoDatasourceParamDTO.setDatabase("default"); prestoDatasourceParamDTO.setUserName("root"); prestoDatasourceParamDTO.setPassword("123456"); - + prestoDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PrestoConnectionParam connectionParams = (PrestoConnectionParam) prestoDatasourceProcessor .createConnectionParams(prestoDatasourceParamDTO); Assert.assertEquals("jdbc:presto://localhost:1234", connectionParams.getAddress()); @@ -78,4 +90,9 @@ public class PrestoDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.PRESTO, prestoDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.PRESTO_VALIDATION_QUERY, prestoDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessorTest.java similarity index 70% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessorTest.java index 706c0aef0f..7e55e26848 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/spark/SparkDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessorTest.java @@ -15,34 +15,48 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.spark; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class SparkDatasourceProcessorTest { private SparkDatasourceProcessor sparkDatasourceProcessor = new SparkDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); SparkDatasourceParamDTO sparkDatasourceParamDTO = new SparkDatasourceParamDTO(); sparkDatasourceParamDTO.setUserName("root"); sparkDatasourceParamDTO.setPassword("12345"); sparkDatasourceParamDTO.setHost("localhost1,localhost2"); sparkDatasourceParamDTO.setPort(1234); sparkDatasourceParamDTO.setDatabase("default"); - + sparkDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); + PowerMockito.mockStatic(CommonUtils.class); + PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(false); SparkConnectionParam connectionParams = (SparkConnectionParam) sparkDatasourceProcessor .createConnectionParams(sparkDatasourceParamDTO); Assert.assertEquals("jdbc:hive2://localhost1:1234,localhost2:1234", connectionParams.getAddress()); @@ -77,4 +91,9 @@ public class SparkDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.SPARK, sparkDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.HIVE_VALIDATION_QUERY, sparkDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessorTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessorTest.java similarity index 72% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessorTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessorTest.java index 39a23f6e25..de5956035c 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/sqlserver/SqlServerDatasourceProcessorTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessorTest.java @@ -15,35 +15,47 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource.sqlserver; +package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver; -import org.apache.dolphinscheduler.common.Constants; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.sql.DriverManager; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class}) +@PrepareForTest({Class.class, DriverManager.class, DatasourceUtil.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) public class SqlServerDatasourceProcessorTest { private SqlServerDatasourceProcessor sqlServerDatasourceProcessor = new SqlServerDatasourceProcessor(); @Test public void testCreateConnectionParams() { + Map props = new HashMap<>(); + props.put("serverTimezone", "utc"); SqlServerDatasourceParamDTO sqlServerDatasourceParamDTO = new SqlServerDatasourceParamDTO(); sqlServerDatasourceParamDTO.setUserName("root"); sqlServerDatasourceParamDTO.setPassword("123456"); sqlServerDatasourceParamDTO.setDatabase("default"); sqlServerDatasourceParamDTO.setHost("localhost"); sqlServerDatasourceParamDTO.setPort(1234); - + sqlServerDatasourceParamDTO.setOther(props); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); SqlServerConnectionParam connectionParams = (SqlServerConnectionParam) sqlServerDatasourceProcessor .createConnectionParams(sqlServerDatasourceParamDTO); Assert.assertEquals("jdbc:sqlserver://localhost:1234", connectionParams.getAddress()); @@ -78,4 +90,9 @@ public class SqlServerDatasourceProcessorTest { public void testGetDbType() { Assert.assertEquals(DbType.SQLSERVER, sqlServerDatasourceProcessor.getDbType()); } + + @Test + public void testGetValidationQuery() { + Assert.assertEquals(Constants.SQLSERVER_VALIDATION_QUERY, sqlServerDatasourceProcessor.getValidationQuery()); + } } \ No newline at end of file diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java new file mode 100644 index 0000000000..82bc257ee8 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java @@ -0,0 +1,52 @@ +/* + * 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.dolphinscheduler.plugin.datasource.api.provider; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import com.zaxxer.hikari.HikariDataSource; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(value = {HikariDataSource.class, JdbcDataSourceProvider.class}) +public class JdbcDataSourceProviderTest { + + @Test + public void testCreateJdbcDataSource() { + PowerMockito.mockStatic(JdbcDataSourceProvider.class); + HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class); + PowerMockito.when(JdbcDataSourceProvider.createJdbcDataSource(Mockito.any())).thenReturn(dataSource); + Assert.assertNotNull(JdbcDataSourceProvider.createJdbcDataSource(new MysqlConnectionParam())); + } + + @Test + public void testCreateOneSessionJdbcDataSource() { + PowerMockito.mockStatic(JdbcDataSourceProvider.class); + HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class); + PowerMockito.when(JdbcDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any())).thenReturn(dataSource); + Assert.assertNotNull(JdbcDataSourceProvider.createOneSessionJdbcDataSource(new MysqlConnectionParam())); + } + +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtilsTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtilsTest.java new file mode 100644 index 0000000000..61f78ba634 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtilsTest.java @@ -0,0 +1,124 @@ +/* + * 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.dolphinscheduler.plugin.datasource.api.utils; + +import static org.apache.dolphinscheduler.spi.task.TaskConstants.DATASOURCE_ENCRYPTION_ENABLE; + +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.security.UserGroupInformation; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.spi.utils.PropertyUtils") +@PrepareForTest(value = {PropertyUtils.class, UserGroupInformation.class, CommonUtils.class, PasswordUtils.class}) +public class CommonUtilsTest { + + @Test + public void testGetKerberosStartupState() { + PowerMockito.mockStatic(CommonUtils.class); + PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(false); + boolean kerberosStartupState = CommonUtils.getKerberosStartupState(); + Assert.assertFalse(kerberosStartupState); + + PowerMockito.mockStatic(PropertyUtils.class); + PowerMockito.when(PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE)).thenReturn("HDFS"); + PowerMockito.when(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, true)).thenReturn(Boolean.TRUE); + kerberosStartupState = CommonUtils.getKerberosStartupState(); + Assert.assertFalse(kerberosStartupState); + } + + @Test + public void testLoadKerberosConf() { + try { + PowerMockito.mockStatic(PropertyUtils.class); + PowerMockito.when(PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE)).thenReturn("HDFS"); + PowerMockito.when(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)).thenReturn(Boolean.TRUE); + PowerMockito.when(PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH)).thenReturn("/opt/krb5.conf"); + PowerMockito.when(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME)).thenReturn("hdfs-mycluster@ESZ.COM"); + PowerMockito.when(PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH)).thenReturn("/opt/hdfs.headless.keytab"); + + PowerMockito.mockStatic(UserGroupInformation.class); + boolean result = CommonUtils.loadKerberosConf(new Configuration()); + Assert.assertTrue(result); + + CommonUtils.loadKerberosConf(null, null, null); + + } catch (Exception e) { + Assert.fail("load Kerberos Conf failed"); + } + } + + @Test + public void encodePassword() { + PowerMockito.mockStatic(PropertyUtils.class); + PowerMockito.when(PropertyUtils.getBoolean(DATASOURCE_ENCRYPTION_ENABLE, false)).thenReturn(Boolean.TRUE); + + Assert.assertEquals("", PasswordUtils.encodePassword("")); + Assert.assertEquals("bnVsbE1USXpORFUy", PasswordUtils.encodePassword("123456")); + Assert.assertEquals("bnVsbElWRkJXbGhUVjBBPQ==", PasswordUtils.encodePassword("!QAZXSW@")); + Assert.assertEquals("bnVsbE5XUm1aMlZ5S0VBPQ==", PasswordUtils.encodePassword("5dfger(@")); + + PowerMockito.when(PropertyUtils.getBoolean(DATASOURCE_ENCRYPTION_ENABLE, false)).thenReturn(Boolean.FALSE); + + Assert.assertEquals("", PasswordUtils.encodePassword("")); + Assert.assertEquals("123456", PasswordUtils.encodePassword("123456")); + Assert.assertEquals("!QAZXSW@", PasswordUtils.encodePassword("!QAZXSW@")); + Assert.assertEquals("5dfger(@", PasswordUtils.encodePassword("5dfger(@")); + + } + + @Test + public void decodePassword() { + PowerMockito.mockStatic(PropertyUtils.class); + PowerMockito.when(PropertyUtils.getBoolean(DATASOURCE_ENCRYPTION_ENABLE, false)).thenReturn(Boolean.TRUE); + + PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "true"); + + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.decodePassword("bnVsbE1USXpORFUy")).thenReturn("123456"); + PowerMockito.when(PasswordUtils.decodePassword("bnVsbElWRkJXbGhUVjBBPQ==")).thenReturn("!QAZXSW@"); + PowerMockito.when(PasswordUtils.decodePassword("bnVsbE5XUm1aMlZ5S0VBPQ==")).thenReturn("5dfger(@"); + + Assert.assertEquals(null, PasswordUtils.decodePassword("")); + Assert.assertEquals("123456", PasswordUtils.decodePassword("bnVsbE1USXpORFUy")); + Assert.assertEquals("!QAZXSW@", PasswordUtils.decodePassword("bnVsbElWRkJXbGhUVjBBPQ==")); + Assert.assertEquals("5dfger(@", PasswordUtils.decodePassword("bnVsbE5XUm1aMlZ5S0VBPQ==")); + + PowerMockito.when(PropertyUtils.getBoolean(DATASOURCE_ENCRYPTION_ENABLE, false)).thenReturn(Boolean.FALSE); + + PowerMockito.when(PasswordUtils.decodePassword("123456")).thenReturn("123456"); + PowerMockito.when(PasswordUtils.decodePassword("!QAZXSW@")).thenReturn("!QAZXSW@"); + PowerMockito.when(PasswordUtils.decodePassword("5dfger(@")).thenReturn("5dfger(@"); + + Assert.assertEquals(null, PasswordUtils.decodePassword("")); + Assert.assertEquals("123456", PasswordUtils.decodePassword("123456")); + Assert.assertEquals("!QAZXSW@", PasswordUtils.decodePassword("!QAZXSW@")); + Assert.assertEquals("5dfger(@", PasswordUtils.decodePassword("5dfger(@")); + } + +} diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtilTest.java similarity index 76% rename from dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtilTest.java index 1b8b59cd99..0078fb03d5 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/datasource/DatasourceUtilTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DatasourceUtilTest.java @@ -15,19 +15,20 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; +package org.apache.dolphinscheduler.plugin.datasource.api.utils; -import java.util.HashMap; -import java.util.Map; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlConnectionParam; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceParamDTO; -import org.apache.dolphinscheduler.common.datasource.mysql.MysqlDatasourceProcessor; -import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.utils.JSONUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceProcessor; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; +import org.apache.dolphinscheduler.spi.enums.DbType; +import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.sql.Connection; import java.sql.DriverManager; -import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; import org.junit.Assert; import org.junit.Test; @@ -38,7 +39,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({Class.class, DriverManager.class, MysqlDatasourceProcessor.class}) +@PrepareForTest({Class.class, DriverManager.class, MysqlDatasourceProcessor.class, DataSourceClientProvider.class, PasswordUtils.class, CommonUtils.class}) public class DatasourceUtilTest { @Test @@ -63,6 +64,10 @@ public class DatasourceUtilTest { mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setPort(3306); mysqlDatasourceParamDTO.setPassword("123456"); + PowerMockito.mockStatic(PasswordUtils.class); + PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("123456"); + PowerMockito.mockStatic(CommonUtils.class); + PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(false); ConnectionParam connectionParam = DatasourceUtil.buildConnectionParams(mysqlDatasourceParamDTO); Assert.assertNotNull(connectionParam); } @@ -80,18 +85,21 @@ public class DatasourceUtilTest { } @Test - public void testGetConnection() throws ClassNotFoundException, SQLException { - PowerMockito.mockStatic(Class.class); - PowerMockito.when(Class.forName(Mockito.any())).thenReturn(null); - PowerMockito.mockStatic(DriverManager.class); - PowerMockito.when(DriverManager.getConnection(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null); + public void testGetConnection() { + + PowerMockito.mockStatic(DataSourceClientProvider.class); + DataSourceClientProvider clientProvider = PowerMockito.mock(DataSourceClientProvider.class); + PowerMockito.when(DataSourceClientProvider.getInstance()).thenReturn(clientProvider); + + Connection connection = PowerMockito.mock(Connection.class); + PowerMockito.when(clientProvider.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection); MysqlConnectionParam connectionParam = new MysqlConnectionParam(); connectionParam.setUser("root"); connectionParam.setPassword("123456"); - Connection connection = DatasourceUtil.getConnection(DbType.MYSQL, connectionParam); + connection = DataSourceClientProvider.getInstance().getConnection(DbType.MYSQL, connectionParam); - Assert.assertNull(connection); + Assert.assertNotNull(connection); } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/pom.xml new file mode 100644 index 0000000000..55257481a5 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/pom.xml @@ -0,0 +1,89 @@ + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-clickhouse + ${project.artifactId} + jar + + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + provided + + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + + + + ru.yandex.clickhouse + clickhouse-jdbc + + + jaxb-api + javax.xml.bind + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-core + + + ${clickhouse.jdbc.version} + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.mockito + mockito-core + jar + test + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannel.java similarity index 62% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannel.java index e71be3e2bd..7557febdd3 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannel.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.feishu; +package org.apache.dolphinscheduler.plugin.datasource.clickhouse; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; +public class ClickhouseDataSourceChannel implements DataSourceChannel { -public class FeiShuAlertPlugin implements DolphinSchedulerPlugin { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new FeiShuAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new ClickhouseDataSourceClient(baseConnectionParam); } } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactory.java new file mode 100644 index 0000000000..c81d810efb --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.clickhouse; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class ClickhouseDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "clickhouse"; + } + + @Override + public DataSourceChannel create() { + return new ClickhouseDataSourceChannel(); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceClient.java similarity index 66% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceClient.java index 965860d868..f16599c50c 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertConstants.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceClient.java @@ -15,21 +15,15 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.http; +package org.apache.dolphinscheduler.plugin.datasource.clickhouse; -public class HttpAlertConstants { +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; - private HttpAlertConstants() { - } - - public static final String URL = "url"; - - public static final String HEADER_PARAMS = "headerParams"; +public class ClickhouseDataSourceClient extends CommonDataSourceClient { - public static final String BODY_PARAMS = "bodyParams"; - - public static final String CONTENT_FIELD = "contentField"; - - public static final String REQUEST_TYPE = "requestType"; + public ClickhouseDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); + } } diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPluginTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactoryTest.java similarity index 65% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPluginTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactoryTest.java index 7dac686e88..5bfb884d97 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPluginTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactoryTest.java @@ -15,24 +15,19 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.http; +package org.apache.dolphinscheduler.plugin.datasource.clickhouse; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; import org.junit.Assert; import org.junit.Test; -/** - * HttpAlertPlugin UT - */ -public class HttpAlertPluginTest { +public class ClickhouseDataSourceChannelFactoryTest { @Test - public void getAlertChannelFactorysTest() { - - HttpAlertPlugin httpAlertPlugin = new HttpAlertPlugin(); - Iterable alertChannelFactorys = httpAlertPlugin.getAlertChannelFactorys(); - Assert.assertNotNull(alertChannelFactorys); - + public void testCreate() { + ClickhouseDataSourceChannelFactory sourceChannelFactory = new ClickhouseDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); } } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelTest.java new file mode 100644 index 0000000000..e7a77b62c2 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.clickhouse; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickhouseConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({ClickhouseDataSourceClient.class, ClickhouseDataSourceChannel.class}) +public class ClickhouseDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + ClickhouseDataSourceChannel sourceChannel = PowerMockito.mock(ClickhouseDataSourceChannel.class); + ClickhouseDataSourceClient dataSourceClient = PowerMockito.mock(ClickhouseDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new ClickhouseConnectionParam())); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/pom.xml new file mode 100644 index 0000000000..6b967648b9 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/pom.xml @@ -0,0 +1,65 @@ + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-db2 + ${project.artifactId} + jar + + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + provided + + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.mockito + mockito-core + jar + test + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannel.java similarity index 63% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannel.java index 973f1617a6..92da758ff8 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannel.java @@ -15,20 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.http; +package org.apache.dolphinscheduler.plugin.datasource.db2; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; - -/** - * http alertPlugins - */ -public class HttpAlertPlugin implements DolphinSchedulerPlugin { +public class DB2DataSourceChannel implements DataSourceChannel { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new HttpAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new DB2DataSourceClient(baseConnectionParam); } } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactory.java similarity index 61% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactory.java index 3e2f7ad205..cda8a2e592 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactory.java @@ -15,17 +15,23 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datax; +package org.apache.dolphinscheduler.plugin.datasource.db2; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; -import com.google.common.collect.ImmutableList; +import com.google.auto.service.AutoService; -public class DataxTaskPlugin implements DolphinSchedulerPlugin { +@AutoService(DataSourceChannelFactory.class) +public class DB2DataSourceChannelFactory implements DataSourceChannelFactory { @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new DataxTaskChannelFactory()); + public String getName() { + return "db2"; + } + + @Override + public DataSourceChannel create() { + return new DB2DataSourceChannel(); } } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/exception/PluginNotFoundException.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceClient.java similarity index 67% rename from dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/exception/PluginNotFoundException.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceClient.java index 2153299f17..ab59b3f1d5 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/exception/PluginNotFoundException.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/main/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceClient.java @@ -15,17 +15,15 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.spi.exception; +package org.apache.dolphinscheduler.plugin.datasource.db2; -public class PluginNotFoundException extends RuntimeException { +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; - private static final long serialVersionUID = -5487812425126112159L; +public class DB2DataSourceClient extends CommonDataSourceClient { - public PluginNotFoundException(String message, Throwable cause) { - super(message, cause); + public DB2DataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); } - public PluginNotFoundException(String message) { - super(message); - } } diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ConnectionFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactoryTest.java similarity index 65% rename from dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ConnectionFactoryTest.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactoryTest.java index 1d419a83d8..89be3f70a6 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ConnectionFactoryTest.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelFactoryTest.java @@ -14,24 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dolphinscheduler.dao.mapper; -import org.apache.dolphinscheduler.dao.datasource.ConnectionFactory; -import org.junit.Assert; -import org.junit.Test; +package org.apache.dolphinscheduler.plugin.datasource.db2; -import java.sql.Connection; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.junit.Assert; +import org.junit.Test; -public class ConnectionFactoryTest { +public class DB2DataSourceChannelFactoryTest { - /** - * test connection - * @throws Exception if error throws Exception - */ @Test - public void testConnection()throws Exception{ - Connection connection = ConnectionFactory.getInstance().getDataSource().getConnection(); - Assert.assertTrue(connection != null); + public void testCreate() { + DB2DataSourceChannelFactory sourceChannelFactory = new DB2DataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); } -} \ No newline at end of file +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelTest.java new file mode 100644 index 0000000000..ea25bb950c --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-db2/src/test/java/org/apache/dolphinscheduler/plugin/datasource/db2/DB2DataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.db2; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2ConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({DB2DataSourceClient.class, DB2DataSourceChannel.class}) +public class DB2DataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + DB2DataSourceChannel sourceChannel = PowerMockito.mock(DB2DataSourceChannel.class); + DB2DataSourceClient dataSourceClient = PowerMockito.mock(DB2DataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new Db2ConnectionParam())); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/pom.xml new file mode 100644 index 0000000000..8047554b16 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/pom.xml @@ -0,0 +1,345 @@ + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-hive + ${project.artifactId} + jar + + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + provided + + + + org.apache.hadoop + hadoop-client + + + org.slf4j + slf4j-log4j12 + + + servlet-api + javax.servlet + + + org.codehaus.jackson + jackson-jaxrs + + + org.codehaus.jackson + jackson-xc + + + + org.fusesource.leveldbjni + leveldbjni-all + + + org.apache.zookeeper + zookeeper + + + org.apache.hadoop + hadoop-mapreduce-client-shuffle + + + jersey-client + com.sun.jersey + + + jersey-core + com.sun.jersey + + + jaxb-api + javax.xml.bind + + + log4j + log4j + + + + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + + + + + org.apache.hive + hive-jdbc + ${hive.jdbc.version} + + + slf4j-log4j12 + org.slf4j + + + org.eclipse.jetty.aggregate + jetty-all + + + + org.apache.ant + ant + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + com.github.joshelser + dropwizard-metrics-hadoop-metrics2-reporter + + + + io.netty + netty-all + + + com.google.code.gson + gson + + + com.google.code.findbugs + jsr305 + + + io.dropwizard.metrics + metrics-core + + + javax.servlet + servlet-api + + + org.apache.avro + avro + + + org.apache.commons + commons-compress + + + org.apache.curator + curator-client + + + org.apache.hadoop + hadoop-auth + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + org.apache.hadoop + hadoop-yarn-api + + + + org.apache.zookeeper + zookeeper + + + org.codehaus.jackson + jackson-jaxrs + + + org.codehaus.jackson + jackson-xc + + + com.google.protobuf + protobuf-java + + + org.json + json + + + log4j-slf4j-impl + org.apache.logging.log4j + + + javax.servlet + org.eclipse.jetty.orbit + + + servlet-api-2.5 + org.mortbay.jetty + + + jasper-runtime + tomcat + + + slider-core + org.apache.slider + + + hbase-server + org.apache.hbase + + + jersey-client + com.sun.jersey + + + jersey-core + com.sun.jersey + + + jersey-json + com.sun.jersey + + + jersey-server + com.sun.jersey + + + jersey-guice + com.sun.jersey.contribs + + + hbase-common + org.apache.hbase + + + hbase-hadoop2-compat + org.apache.hbase + + + hbase-client + org.apache.hbase + + + hbase-hadoop-compat + org.apache.hbase + + + tephra-hbase-compat-1.0 + co.cask.tephra + + + jaxb-api + javax.xml.bind + + + hive-llap-client + org.apache.hive + + + hive-llap-common + org.apache.hive + + + hive-llap-server + org.apache.hive + + + tephra-core + co.cask.tephra + + + ant + ant + + + stringtemplate + org.antlr + + + antlr-runtime + org.antlr + + + hive-shims + org.apache.hive + + + jsp-api + javax.servlet + + + log4j-api + org.apache.logging.log4j + + + log4j-core + org.apache.logging.log4j + + + log4j-web + org.apache.logging.log4j + + + jasper-compiler + tomcat + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.mockito + mockito-core + jar + test + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannel.java similarity index 62% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannel.java index 59c45ae4ac..106fe99f51 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannel.java @@ -15,20 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.slack; +package org.apache.dolphinscheduler.plugin.datasource.hive; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; - -/** - * Slack alert plugin - */ -public class SlackAlertPlugin implements DolphinSchedulerPlugin { +public class HiveDataSourceChannel implements DataSourceChannel { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new SlackAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new HiveDataSourceClient(baseConnectionParam); } } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactory.java new file mode 100644 index 0000000000..12556b66be --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.hive; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class HiveDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "hive"; + } + + @Override + public DataSourceChannel create() { + return new HiveDataSourceChannel(); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java new file mode 100644 index 0000000000..9b8b62251f --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java @@ -0,0 +1,112 @@ +/* + * 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.dolphinscheduler.plugin.datasource.hive; + +import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF; +import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF_PATH; + +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; +import org.apache.dolphinscheduler.plugin.datasource.utils.CommonUtil; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.security.UserGroupInformation; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.JdbcTemplate; + +import com.zaxxer.hikari.HikariDataSource; + +public class HiveDataSourceClient extends CommonDataSourceClient { + + private static final Logger logger = LoggerFactory.getLogger(HiveDataSourceClient.class); + + protected HikariDataSource oneSessionDataSource; + private UserGroupInformation ugi; + + public HiveDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); + } + + @Override + protected void initClient(BaseConnectionParam baseConnectionParam) { + logger.info("Create UserGroupInformation."); + this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); + logger.info("Create ugi success."); + + super.initClient(baseConnectionParam); + this.oneSessionDataSource = JdbcDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam); + logger.info("Init {} success.", getClass().getName()); + } + + @Override + protected void checkEnv(BaseConnectionParam baseConnectionParam) { + super.checkEnv(baseConnectionParam); + checkKerberosEnv(); + } + + private void checkKerberosEnv() { + String krb5File = PropertyUtils.getString(JAVA_SECURITY_KRB5_CONF_PATH); + if (StringUtils.isNotBlank(krb5File)) { + System.setProperty(JAVA_SECURITY_KRB5_CONF, krb5File); + } + } + + private UserGroupInformation createUserGroupInformation(String username) { + String krb5File = PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH); + String keytab = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH); + String principal = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME); + try { + return CommonUtil.createUGI(getHadoopConf(), principal, keytab, krb5File, username); + } catch (IOException e) { + throw new RuntimeException("createUserGroupInformation fail. ", e); + } + } + + protected Configuration getHadoopConf() { + return new Configuration(); + } + + @Override + public Connection getConnection() { + try { + return oneSessionDataSource.getConnection(); + } catch (SQLException e) { + logger.error("get oneSessionDataSource Connection fail SQLException: {}", e.getMessage(), e); + return null; + } + } + + @Override + public void close() { + super.close(); + logger.info("close HiveDataSourceClient."); + + this.oneSessionDataSource.close(); + this.oneSessionDataSource = null; + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/utils/CommonUtil.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/utils/CommonUtil.java new file mode 100644 index 0000000000..faf8f4aafa --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/utils/CommonUtil.java @@ -0,0 +1,65 @@ +/* + * 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.dolphinscheduler.plugin.datasource.utils; + +import static org.apache.dolphinscheduler.spi.utils.Constants.JAVA_SECURITY_KRB5_CONF; + +import org.apache.dolphinscheduler.spi.enums.ResUploadType; +import org.apache.dolphinscheduler.spi.utils.Constants; +import org.apache.dolphinscheduler.spi.utils.PropertyUtils; +import org.apache.dolphinscheduler.spi.utils.StringUtils; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.security.UserGroupInformation; + +import java.io.IOException; +import java.util.Objects; + +public class CommonUtil { + + private CommonUtil() { + } + + public static boolean getKerberosStartupState() { + String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE); + ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType); + Boolean kerberosStartupState = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false); + return resUploadType == ResUploadType.HDFS && kerberosStartupState; + } + + public static synchronized UserGroupInformation createUGI(Configuration configuration, String principal, String keyTab, String krb5File, String username) + throws IOException { + if (getKerberosStartupState()) { + Objects.requireNonNull(keyTab); + if (StringUtils.isNotBlank(krb5File)) { + System.setProperty(JAVA_SECURITY_KRB5_CONF, krb5File); + } + return loginKerberos(configuration, principal, keyTab); + } + return UserGroupInformation.createRemoteUser(username); + } + + public static synchronized UserGroupInformation loginKerberos(final Configuration config, final String principal, final String keyTab) + throws IOException { + config.set(Constants.HADOOP_SECURITY_AUTHENTICATION, Constants.KERBEROS); + UserGroupInformation.setConfiguration(config); + UserGroupInformation.loginUserFromKeytab(principal.trim(), keyTab.trim()); + return UserGroupInformation.getCurrentUser(); + } + +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactoryTest.java new file mode 100644 index 0000000000..6f74a3dd03 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelFactoryTest.java @@ -0,0 +1,33 @@ +/* + * 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.dolphinscheduler.plugin.datasource.hive; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; + +import org.junit.Assert; +import org.junit.Test; + +public class HiveDataSourceChannelFactoryTest { + + @Test + public void testCreate() { + HiveDataSourceChannelFactory sourceChannelFactory = new HiveDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelTest.java new file mode 100644 index 0000000000..b19d44e0a6 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/test/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.hive; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({HiveDataSourceChannel.class, HiveDataSourceClient.class}) +public class HiveDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + HiveDataSourceChannel sourceChannel = PowerMockito.mock(HiveDataSourceChannel.class); + HiveDataSourceClient dataSourceClient = PowerMockito.mock(HiveDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new HiveConnectionParam())); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/pom.xml similarity index 57% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/pom.xml index 34ff0659f3..388d8b6c55 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/pom.xml +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/pom.xml @@ -15,44 +15,48 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + - dolphinscheduler-alert-plugin + dolphinscheduler-datasource-plugin org.apache.dolphinscheduler 2.0.1-SNAPSHOT 4.0.0 - org.apache.dolphinscheduler - dolphinscheduler-alert-script - dolphinscheduler-plugin + dolphinscheduler-datasource-mysql + ${project.artifactId} + jar - com.google.guava - guava + org.apache.dolphinscheduler + dolphinscheduler-spi + provided - ch.qos.logback - logback-classic + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} - org.slf4j - slf4j-api + mysql + mysql-connector-java - com.fasterxml.jackson.core - jackson-annotations - provided + org.powermock + powermock-module-junit4 + test - junit - junit + org.powermock + powermock-api-mockito2 test @@ -62,17 +66,5 @@ jar test - - - org.jacoco - org.jacoco.agent - runtime - test - - - - dolphinscheduler-alert-script-${project.version} - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannel.java similarity index 62% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannel.java index f2ba0e87d0..6764403c10 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannel.java @@ -15,21 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.script; +package org.apache.dolphinscheduler.plugin.datasource.mysql; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; - -/** - * ScriptAlertPlugin - */ -public class ScriptAlertPlugin implements DolphinSchedulerPlugin { +public class MysqlDataSourceChannel implements DataSourceChannel { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new ScriptAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new MysqlDataSourceClient(baseConnectionParam); } - } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactory.java new file mode 100644 index 0000000000..963aa59e05 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.mysql; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class MysqlDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "mysql"; + } + + @Override + public DataSourceChannel create() { + return new MysqlDataSourceChannel(); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/exception/WeChatAlertException.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceClient.java similarity index 66% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/exception/WeChatAlertException.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceClient.java index f36bc2ff8a..2e2a7dd735 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/exception/WeChatAlertException.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceClient.java @@ -15,16 +15,15 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.wechat.exception; +package org.apache.dolphinscheduler.plugin.datasource.mysql; -public class WeChatAlertException extends RuntimeException { +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; - /** - * Create Runtime Exception - * - * @param errMsg - Error message - */ - public WeChatAlertException(String errMsg) { - super(errMsg); +public class MysqlDataSourceClient extends CommonDataSourceClient { + + public MysqlDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); } + } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactoryTest.java new file mode 100644 index 0000000000..dd0603f8f7 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactoryTest.java @@ -0,0 +1,33 @@ +/* + * 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.dolphinscheduler.plugin.datasource.mysql; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; + +import org.junit.Assert; +import org.junit.Test; + +public class MysqlDataSourceChannelFactoryTest { + + @Test + public void testCreate() { + MysqlDataSourceChannelFactory sourceChannelFactory = new MysqlDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelTest.java new file mode 100644 index 0000000000..216485c7b9 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.mysql; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({MysqlDataSourceClient.class, MysqlDataSourceChannel.class}) +public class MysqlDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + MysqlDataSourceChannel sourceChannel = PowerMockito.mock(MysqlDataSourceChannel.class); + MysqlDataSourceClient dataSourceClient = PowerMockito.mock(MysqlDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new MysqlConnectionParam())); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/pom.xml new file mode 100644 index 0000000000..9cdf018fff --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/pom.xml @@ -0,0 +1,65 @@ + + + + + dolphinscheduler-datasource-plugin + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + + dolphinscheduler-datasource-oracle + ${project.artifactId} + jar + + + + + org.apache.dolphinscheduler + dolphinscheduler-spi + provided + + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.mockito + mockito-core + jar + test + + + diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannel.java similarity index 62% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannel.java index 2d15f499c9..7dd06b8952 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannel.java @@ -15,20 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.dingtalk; +package org.apache.dolphinscheduler.plugin.datasource.oracle; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; - -/** - * DingTalkAlertPlugin - */ -public class DingTalkAlertPlugin implements DolphinSchedulerPlugin { +public class OracleDataSourceChannel implements DataSourceChannel { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new DingTalkAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new OracleDataSourceClient(baseConnectionParam); } } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactory.java new file mode 100644 index 0000000000..8fcc47766b --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.oracle; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class OracleDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "oracle"; + } + + @Override + public DataSourceChannel create() { + return new OracleDataSourceChannel(); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceClient.java new file mode 100644 index 0000000000..8706022de7 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/main/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceClient.java @@ -0,0 +1,29 @@ +/* + * 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.dolphinscheduler.plugin.datasource.oracle; + +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; + +public class OracleDataSourceClient extends CommonDataSourceClient { + + public OracleDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); + } + +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactoryTest.java new file mode 100644 index 0000000000..0dc4af4635 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelFactoryTest.java @@ -0,0 +1,33 @@ +/* + * 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.dolphinscheduler.plugin.datasource.oracle; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; + +import org.junit.Assert; +import org.junit.Test; + +public class OracleDataSourceChannelFactoryTest { + + @Test + public void testCreate() { + OracleDataSourceChannelFactory sourceChannelFactory = new OracleDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelTest.java new file mode 100644 index 0000000000..82d836bd8e --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-oracle/src/test/java/org/apache/dolphinscheduler/plugin/datasource/oracle/OracleDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.oracle; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({OracleDataSourceClient.class, OracleDataSourceChannel.class}) +public class OracleDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + OracleDataSourceChannel sourceChannel = PowerMockito.mock(OracleDataSourceChannel.class); + OracleDataSourceClient dataSourceClient = PowerMockito.mock(OracleDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new OracleConnectionParam())); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/pom.xml similarity index 61% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/pom.xml index 99a09187d7..e6b11fb196 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/pom.xml +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/pom.xml @@ -15,62 +15,60 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + - dolphinscheduler-alert-plugin + dolphinscheduler-datasource-plugin org.apache.dolphinscheduler 2.0.1-SNAPSHOT 4.0.0 - dolphinscheduler-alert-http - dolphinscheduler-plugin + dolphinscheduler-datasource-postgresql + ${project.artifactId} + jar + - com.google.guava - guava + org.apache.dolphinscheduler + dolphinscheduler-spi + provided - ch.qos.logback - logback-classic + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} - org.apache.httpcomponents - httpclient + com.google.guava + guava - com.fasterxml.jackson.core - jackson-databind - provided + org.postgresql + postgresql - junit - junit + org.powermock + powermock-module-junit4 test - org.mockito - mockito-core - jar + org.powermock + powermock-api-mockito2 test - org.jacoco - org.jacoco.agent - runtime + org.mockito + mockito-core test - - - dolphinscheduler-alert-http-${project.version} - - diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannel.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannel.java new file mode 100644 index 0000000000..ce2ab2248f --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannel.java @@ -0,0 +1,30 @@ +/* + * 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.dolphinscheduler.plugin.datasource.postgresql; + +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; + +public class PostgresqlDataSourceChannel implements DataSourceChannel { + + @Override + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new PostgresqlDataSourceClient(baseConnectionParam); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactory.java new file mode 100644 index 0000000000..eda1a336cc --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.postgresql; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class PostgresqlDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "postgresql"; + } + + @Override + public DataSourceChannel create() { + return new PostgresqlDataSourceChannel(); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceClient.java new file mode 100644 index 0000000000..19e8b53ef5 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceClient.java @@ -0,0 +1,29 @@ +/* + * 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.dolphinscheduler.plugin.datasource.postgresql; + +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; + +public class PostgresqlDataSourceClient extends CommonDataSourceClient { + + public PostgresqlDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); + } + +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactoryTest.java new file mode 100644 index 0000000000..7b45926778 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactoryTest.java @@ -0,0 +1,33 @@ +/* + * 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.dolphinscheduler.plugin.datasource.postgresql; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; + +import org.junit.Assert; +import org.junit.Test; + +public class PostgresqlDataSourceChannelFactoryTest { + + @Test + public void testCreate() { + PostgresqlDataSourceChannelFactory sourceChannelFactory = new PostgresqlDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelTest.java new file mode 100644 index 0000000000..1251540cd1 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.postgresql; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({PostgresqlDataSourceClient.class, PostgresqlDataSourceChannel.class}) +public class PostgresqlDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + PostgresqlDataSourceChannel sourceChannel = PowerMockito.mock(PostgresqlDataSourceChannel.class); + PostgresqlDataSourceClient dataSourceClient = PowerMockito.mock(PostgresqlDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new PostgreSqlConnectionParam())); + } +} diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/pom.xml similarity index 53% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/pom.xml index d6238ab6d7..5016d581bf 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/pom.xml +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/pom.xml @@ -15,68 +15,61 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + + - dolphinscheduler-alert-plugin + dolphinscheduler-datasource-plugin org.apache.dolphinscheduler 2.0.1-SNAPSHOT 4.0.0 - org.apache.dolphinscheduler - dolphinscheduler-alert-feishu - dolphinscheduler-plugin + dolphinscheduler-datasource-sqlserver + ${project.artifactId} + jar - - - org.apache.httpcomponents - httpclient - - com.google.guava - guava + org.apache.dolphinscheduler + dolphinscheduler-spi + provided - - ch.qos.logback - logback-classic + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} - org.slf4j - slf4j-api + com.microsoft.sqlserver + mssql-jdbc + + + azure-keyvault + com.microsoft.azure + + + ${mssql.jdbc.version} - com.fasterxml.jackson.core - jackson-annotations - provided + org.powermock + powermock-module-junit4 + test - junit - junit + org.powermock + powermock-api-mockito2 test org.mockito mockito-core - jar - test - - - - org.jacoco - org.jacoco.agent - runtime test - - - dolphinscheduler-alert-feishu-${project.version} - - diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertPlugin.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannel.java similarity index 62% rename from dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertPlugin.java rename to dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannel.java index 175b518189..ce9cce713a 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertPlugin.java +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannel.java @@ -15,19 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.alert.email; +package org.apache.dolphinscheduler.plugin.datasource.sqlserver; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; -import com.google.common.collect.ImmutableList; +public class SqlServerDataSourceChannel implements DataSourceChannel { -/** - * email alert plugin - */ -public class EmailAlertPlugin implements DolphinSchedulerPlugin { @Override - public Iterable getAlertChannelFactorys() { - return ImmutableList.of(new EmailAlertChannelFactory()); + public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam) { + return new SqlserverDataSourceClient(baseConnectionParam); } } diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannelFactory.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannelFactory.java new file mode 100644 index 0000000000..cab272bf7f --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannelFactory.java @@ -0,0 +1,36 @@ +/* + * 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.dolphinscheduler.plugin.datasource.sqlserver; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory; + +import com.google.auto.service.AutoService; + +@AutoService(DataSourceChannelFactory.class) +public class SqlServerDataSourceChannelFactory implements DataSourceChannelFactory { + @Override + public String getName() { + return "sqlserver"; + } + + @Override + public DataSourceChannel create() { + return new SqlServerDataSourceChannel(); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceClient.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceClient.java new file mode 100644 index 0000000000..2a90684f53 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceClient.java @@ -0,0 +1,29 @@ +/* + * 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.dolphinscheduler.plugin.datasource.sqlserver; + +import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; + +public class SqlserverDataSourceClient extends CommonDataSourceClient { + + public SqlserverDataSourceClient(BaseConnectionParam baseConnectionParam) { + super(baseConnectionParam); + } + +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelFactoryTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelFactoryTest.java new file mode 100644 index 0000000000..bfa4df68e9 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelFactoryTest.java @@ -0,0 +1,33 @@ +/* + * 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.dolphinscheduler.plugin.datasource.sqlserver; + +import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel; + +import org.junit.Assert; +import org.junit.Test; + +public class SqlserverDataSourceChannelFactoryTest { + + @Test + public void testCreate() { + SqlServerDataSourceChannelFactory sourceChannelFactory = new SqlServerDataSourceChannelFactory(); + DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); + Assert.assertNotNull(dataSourceChannel); + } +} diff --git a/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelTest.java b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelTest.java new file mode 100644 index 0000000000..e9c18112db --- /dev/null +++ b/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelTest.java @@ -0,0 +1,43 @@ +/* + * 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.dolphinscheduler.plugin.datasource.sqlserver; + +import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerConnectionParam; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") +@PrepareForTest({SqlserverDataSourceClient.class, SqlServerDataSourceChannel.class}) +public class SqlserverDataSourceChannelTest { + + @Test + public void testCreateDataSourceClient() { + SqlServerDataSourceChannel sourceChannel = PowerMockito.mock(SqlServerDataSourceChannel.class); + SqlserverDataSourceClient dataSourceClient = PowerMockito.mock(SqlserverDataSourceClient.class); + PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any())).thenReturn(dataSourceClient); + Assert.assertNotNull(sourceChannel.createDataSourceClient(new SqlServerConnectionParam())); + } +} diff --git a/dolphinscheduler-datasource-plugin/pom.xml b/dolphinscheduler-datasource-plugin/pom.xml new file mode 100644 index 0000000000..5fc8fb30d0 --- /dev/null +++ b/dolphinscheduler-datasource-plugin/pom.xml @@ -0,0 +1,42 @@ + + + + + dolphinscheduler + org.apache.dolphinscheduler + 2.0.1-SNAPSHOT + + 4.0.0 + dolphinscheduler-datasource-plugin + ${project.artifactId} + pom + + + dolphinscheduler-datasource-sqlserver + dolphinscheduler-datasource-clickhouse + dolphinscheduler-datasource-db2 + dolphinscheduler-datasource-hive + dolphinscheduler-datasource-mysql + dolphinscheduler-datasource-oracle + dolphinscheduler-datasource-postgresql + dolphinscheduler-datasource-api + dolphinscheduler-datasource-all + + diff --git a/dolphinscheduler-dist/pom.xml b/dolphinscheduler-dist/pom.xml index 00e0773d1b..eefa30737e 100644 --- a/dolphinscheduler-dist/pom.xml +++ b/dolphinscheduler-dist/pom.xml @@ -49,7 +49,7 @@ org.apache.dolphinscheduler - dolphinscheduler-alert + dolphinscheduler-alert-server @@ -328,7 +328,7 @@ - ${basedir}/../sql + ${basedir}/../dolphinscheduler-dao/src/main/resources/sql **/*.* @@ -336,7 +336,7 @@ - ${basedir}/../sql + ${basedir}/../dolphinscheduler-dao/src/main/resources/sql soft_version @@ -379,7 +379,9 @@ - + + apache-dolphinscheduler-${project.version} + diff --git a/dolphinscheduler-dist/release-docs/LICENSE b/dolphinscheduler-dist/release-docs/LICENSE index 8707314c7d..a9abb80840 100644 --- a/dolphinscheduler-dist/release-docs/LICENSE +++ b/dolphinscheduler-dist/release-docs/LICENSE @@ -217,23 +217,22 @@ The text of each license is also included at licenses/LICENSE-[project].txt. apacheds-i18n 2.0.0-M15: https://mvnrepository.com/artifact/org.apache.directory.server/apacheds-i18n/2.0.0-M15, Apache 2.0 apacheds-kerberos-codec 2.0.0-M15: https://mvnrepository.com/artifact/org.apache.directory.server/apacheds-kerberos-codec/2.0.0-M15, Apache 2.0 - apache-el 8.5.54: https://mvnrepository.com/artifact/org.mortbay.jasper/apache-el/8.5.54, Apache 2.0 + tomcat-embed-el 9.0.54: https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el/9.0.54, Apache 2.0 api-asn1-api 1.0.0-M20: https://mvnrepository.com/artifact/org.apache.directory.api/api-asn1-api/1.0.0-M20, Apache 2.0 api-util 1.0.0-M20: https://mvnrepository.com/artifact/org.apache.directory.api/api-util/1.0.0-M20, Apache 2.0 - async-http-client 1.6.5: https://mvnrepository.com/artifact/com.ning/async-http-client, Apache 2.0 audience-annotations 0.5.0: https://mvnrepository.com/artifact/org.apache.yetus/audience-annotations/0.5.0, Apache 2.0 avro 1.7.4: https://github.com/apache/avro, Apache 2.0 aws-sdk-java 1.7.4: https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk/1.7.4, Apache 2.0 bonecp 0.8.0.RELEASE: https://github.com/wwadge/bonecp, Apache 2.0 byte-buddy 1.9.16: https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy/1.9.16, Apache 2.0 - classmate 1.4.0: https://mvnrepository.com/artifact/com.fasterxml/classmate/1.4.0, Apache 2.0 + classmate 1.5.1: https://mvnrepository.com/artifact/com.fasterxml/classmate/1.5.1, Apache 2.0 clickhouse-jdbc 0.1.52: https://mvnrepository.com/artifact/ru.yandex.clickhouse/clickhouse-jdbc/0.1.52, Apache 2.0 commons-beanutils 1.9.4 https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils/1.9.4, Apache 2.0 commons-cli 1.2: https://mvnrepository.com/artifact/commons-cli/commons-cli/1.2, Apache 2.0 commons-codec 1.11: https://mvnrepository.com/artifact/commons-codec/commons-codec/1.11, Apache 2.0 commons-collections 3.2.2: https://mvnrepository.com/artifact/commons-collections/commons-collections/3.2.2, Apache 2.0 commons-collections4 4.1: https://mvnrepository.com/artifact/org.apache.commons/commons-collections4/4.1, Apache 2.0 - commons-compress 1.19: https://mvnrepository.com/artifact/org.apache.commons/commons-compress/1.19, Apache 2.0 + commons-compress 1.4.1: https://mvnrepository.com/artifact/org.apache.commons/commons-compress/1.4.1, Apache 2.0 commons-configuration 1.10: https://mvnrepository.com/artifact/commons-configuration/commons-configuration/1.10, Apache 2.0 commons-daemon 1.0.13 https://mvnrepository.com/artifact/commons-daemon/commons-daemon/1.0.13, Apache 2.0 commons-dbcp 1.4: https://github.com/apache/commons-dbcp, Apache 2.0 @@ -242,10 +241,11 @@ The text of each license is also included at licenses/LICENSE-[project].txt. commons-io 2.4: https://github.com/apache/commons-io, Apache 2.0 commons-lang 2.6: https://github.com/apache/commons-lang, Apache 2.0 commons-logging 1.1.1: https://github.com/apache/commons-logging, Apache 2.0 - commons-math3 3.6.1: https://mvnrepository.com/artifact/org.apache.commons/commons-math3/3.6.1, Apache 2.0 + commons-math3 3.1.1: https://mvnrepository.com/artifact/org.apache.commons/commons-math3/3.1.1, Apache 2.0 commons-net 3.1: https://github.com/apache/commons-net, Apache 2.0 commons-pool 1.6: https://github.com/apache/commons-pool, Apache 2.0 - cron-utils 5.0.5: https://mvnrepository.com/artifact/com.cronutils/cron-utils/5.0.5, Apache 2.0 + cron-utils 9.1.3: https://mvnrepository.com/artifact/com.cronutils/cron-utils/9.1.3, Apache 2.0 + commons-lang3 3.12.0: https://mvnrepository.com/artifact/org.apache.commons/commons-lang3/3.12.0, Apache 2.0 curator-client 4.3.0: https://mvnrepository.com/artifact/org.apache.curator/curator-client/4.3.0, Apache 2.0 curator-framework 4.3.0: https://mvnrepository.com/artifact/org.apache.curator/curator-framework/4.3.0, Apache 2.0 curator-recipes 4.3.0: https://mvnrepository.com/artifact/org.apache.curator/curator-recipes/4.3.0, Apache 2.0 @@ -256,8 +256,9 @@ The text of each license is also included at licenses/LICENSE-[project].txt. derby 10.14.2.0: https://github.com/apache/derby, Apache 2.0 druid 1.1.14: https://mvnrepository.com/artifact/com.alibaba/druid/1.1.14, Apache 2.0 error_prone_annotations 2.1.3 https://mvnrepository.com/artifact/com.google.errorprone/error_prone_annotations/2.1.3, Apache 2.0 - gson 2.8.6: https://github.com/google/gson, Apache 2.0 + gson 2.8.8: https://github.com/google/gson, Apache 2.0 guava 24.1-jre: https://mvnrepository.com/artifact/com.google.guava/guava/24.1-jre, Apache 2.0 + guava-retrying 2.0.0: https://mvnrepository.com/artifact/com.github.rholder/guava-retrying/2.0.0, Apache 2.0 guice 3.0: https://mvnrepository.com/artifact/com.google.inject/guice/3.0, Apache 2.0 guice-servlet 3.0: https://mvnrepository.com/artifact/com.google.inject.extensions/guice-servlet/3.0, Apache 2.0 hadoop-annotations 2.7.3:https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-annotations/2.7.3, Apache 2.0 @@ -275,8 +276,7 @@ The text of each license is also included at licenses/LICENSE-[project].txt. hadoop-yarn-client 2.7.3: https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-yarn-client/2.7.3, Apache 2.0 hadoop-yarn-common 2.7.3: https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-yarn-common/2.7.3, Apache 2.0 hadoop-yarn-server-common 2.7.3: https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-yarn-server-common/2.7.3, Apache 2.0 - hibernate-validator 6.0.21.Final: https://github.com/hibernate/hibernate-validator, Apache 2.0 - HikariCP 3.2.0: https://mvnrepository.com/artifact/com.zaxxer/HikariCP/3.2.0, Apache 2.0 + HikariCP 4.0.3: https://mvnrepository.com/artifact/com.zaxxer/HikariCP/4.0.3, Apache 2.0 hive-common 2.1.0: https://mvnrepository.com/artifact/org.apache.hive/hive-common/2.1.0, Apache 2.0 hive-jdbc 2.1.0: https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc/2.1.0, Apache 2.0 hive-metastore 2.1.0: https://mvnrepository.com/artifact/org.apache.hive/hive-metastore/2.1.0, Apache 2.0 @@ -293,58 +293,46 @@ The text of each license is also included at licenses/LICENSE-[project].txt. jackson-core 2.10.5: https://github.com/FasterXML/jackson-core, Apache 2.0 jackson-core-asl 1.9.13: https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-core-asl/1.9.13, Apache 2.0 jackson-databind 2.10.5: https://github.com/FasterXML/jackson-databind, Apache 2.0 - jackson-datatype-jdk8 2.9.10: https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.9.10, Apache 2.0 - jackson-datatype-jsr310 2.9.10: https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.9.10, Apache 2.0 + jackson-datatype-jdk8 2.12.5: https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.12.5, Apache 2.0 + jackson-datatype-jsr310 2.12.5: https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.12.5, Apache 2.0 jackson-jaxrs 1.9.13: https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-jaxrs/1.9.13, Apache 2.0 and LGPL 2.1 jackson-mapper-asl 1.9.13: https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-asl/1.9.13, Apache 2.0 - jackson-module-parameter-names 2.9.10: https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-parameter-names/2.9.10, Apache 2.0 + jackson-module-parameter-names 2.12.5: https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-parameter-names/2.12.5, Apache 2.0 jackson-xc 1.9.13: https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-xc/1.9.13, Apache 2.0 and LGPL 2.1 javax.inject 1: https://mvnrepository.com/artifact/javax.inject/javax.inject/1, Apache 2.0 javax.jdo-3.2.0-m3: https://mvnrepository.com/artifact/org.datanucleus/javax.jdo/3.2.0-m3, Apache 2.0 java-xmlbuilder 0.4 : https://mvnrepository.com/artifact/com.jamesmurty.utils/java-xmlbuilder/0.4, Apache 2.0 - jboss-logging 3.3.3.Final: https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging/3.3.3.Final, Apache 2.0 jdo-api 3.0.1: https://mvnrepository.com/artifact/javax.jdo/jdo-api/3.0.1, Apache 2.0 jets3t 0.9.0: https://mvnrepository.com/artifact/net.java.dev.jets3t/jets3t/0.9.0, Apache 2.0 jettison 1.1: https://github.com/jettison-json/jettison, Apache 2.0 jetty 6.1.26: https://mvnrepository.com/artifact/org.mortbay.jetty/jetty/6.1.26, Apache 2.0 and EPL 1.0 - jetty-continuation 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-continuation/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-http 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-http/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-io 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-io/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-security 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-security/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-server 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-servlet 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlet/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-servlets 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets/9.4.33.v20201020, Apache 2.0 and EPL 1.0 + jetty-continuation 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-continuation/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-http 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-http/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-io 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-io/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-security 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-security/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-server 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-servlet 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlet/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-servlets 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets/9.4.44.v20210927, Apache 2.0 and EPL 1.0 jetty-util 6.1.26: https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util/6.1.26, Apache 2.0 and EPL 1.0 - jetty-util 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-webapp 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-webapp/9.4.33.v20201020, Apache 2.0 and EPL 1.0 - jetty-xml 9.4.33.v20201020: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-xml/9.4.33.v20201020, Apache 2.0 and EPL 1.0 + jetty-util 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-util-ajax 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util-ajax/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-webapp 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-webapp/9.4.44.v20210927, Apache 2.0 and EPL 1.0 + jetty-xml 9.4.44.v20210927: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-xml/9.4.44.v20210927, Apache 2.0 and EPL 1.0 jna 4.5.2: https://mvnrepository.com/artifact/net.java.dev.jna/jna/4.5.2, Apache 2.0 and LGPL 2.1 jna-platform 4.5.2: https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform/4.5.2, Apache 2.0 and LGPL 2.1 - joda-time 2.10.8: https://github.com/JodaOrg/joda-time, Apache 2.0 + joda-time 2.5: https://github.com/JodaOrg/joda-time, Apache 2.0 jpam 1.1: https://mvnrepository.com/artifact/net.sf.jpam/jpam/1.1, Apache 2.0 jsqlparser 2.1: https://github.com/JSQLParser/JSqlParser, Apache 2.0 or LGPL 2.1 jsr305 3.0.0: https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305, Apache 2.0 - jsr305 1.3.9: https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305, Apache 2.0 j2objc-annotations 1.1 https://mvnrepository.com/artifact/com.google.j2objc/j2objc-annotations/1.1, Apache 2.0 libfb303 0.9.3: https://mvnrepository.com/artifact/org.apache.thrift/libfb303/0.9.3, Apache 2.0 libthrift 0.9.3: https://mvnrepository.com/artifact/org.apache.thrift/libthrift/0.9.3, Apache 2.0 log4j-api 2.11.2: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api/2.11.2, Apache 2.0 log4j-core-2.11.2: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core/2.11.2, Apache 2.0 log4j 1.2.17: https://mvnrepository.com/artifact/log4j/log4j/1.2.17, Apache 2.0 - log4j-1.2-api 2.11.2: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api/2.11.2, Apache 2.0 + log4j-1.2-api 2.14.1: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api/2.14.1, Apache 2.0 lz4 1.3.0: https://mvnrepository.com/artifact/net.jpountz.lz4/lz4/1.3.0, Apache 2.0 mapstruct 1.2.0.Final: https://github.com/mapstruct/mapstruct, Apache 2.0 - maven-aether-provider 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-aether-provider/3.0.4, Apache 2.0 - maven-artifact 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-artifact/3.0.4, Apache 2.0 - maven-compat 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-compat/3.0.4, Apache 2.0 - maven-core 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-core/3.0.4, Apache 2.0 - maven-embedder 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-embedder/3.0.4, Apache 2.0 - maven-model 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-model/3.0.4, Apache 2.0 - maven-model-builder 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-model-builder/3.0.4, Apache 2.0 - maven-plugin-api 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api/3.0.4, Apache 2.0 - maven-repository-metadata 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-repository-metadata/3.0.4, Apache 2.0 - maven-settings 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-settings/3.0.4, Apache 2.0 - maven-settings-builder 3.0.4: https://mvnrepository.com/artifact/org.apache.maven/maven-settings-builder/3.0.4, Apache 2.0 mybatis 3.5.2 https://mvnrepository.com/artifact/org.mybatis/mybatis/3.5.2, Apache 2.0 mybatis-plus 3.2.0: https://github.com/baomidou/mybatis-plus, Apache 2.0 mybatis-plus-annotation 3.2.0: https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-annotation/3.2.0, Apache 2.0 @@ -353,40 +341,38 @@ The text of each license is also included at licenses/LICENSE-[project].txt. mybatis-plus-extension 3.2.0: https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-extension/3.2.0, Apache 2.0 mybatis-spring 2.0.2: https://mvnrepository.com/artifact/org.mybatis/mybatis-spring/2.0.2, Apache 2.0 netty 3.6.2.Final: https://github.com/netty/netty, Apache 2.0 - netty-all 4.1.53.Final: https://github.com/netty/netty/blob/netty-4.1.53.Final/LICENSE.txt, Apache 2.0 + netty 4.1.53.Final: https://github.com/netty/netty/blob/netty-4.1.53.Final/LICENSE.txt, Apache 2.0 opencsv 2.3: https://mvnrepository.com/artifact/net.sf.opencsv/opencsv/2.3, Apache 2.0 parquet-hadoop-bundle 1.8.1: https://mvnrepository.com/artifact/org.apache.parquet/parquet-hadoop-bundle/1.8.1, Apache 2.0 poi 4.1.2: https://mvnrepository.com/artifact/org.apache.poi/poi/4.1.2, Apache 2.0 poi-ooxml 4.1.2: https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml/4.1.2, Apache 2.0 poi-ooxml-schemas-4.1.2: https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas/4.1.2, Apache 2.0 - plexus-cipher 1.7.0: https://mvnrepository.com/artifact/org.sonatype.plexus/plexus-cipher/1.7.0, Apache 2.0 - plexus-classworlds 2.4: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-classworlds/2.4, Apache 2.0 - plexus-component-annotations 1.5.5: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-component-annotations/1.5.5, Apache 2.0 - plexus-container-default 1.5.5: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-container-default/1.5.5, Apache 2.0 - plexus-interpolation 1.14: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-interpolation/1.14, Apache 2.0 - plexus-sec-dispatcher 1.3: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-sec-dispatcher/1.3, Apache 2.0 - plexus-utils 2.0.6: https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils/2.0.6, Apache 2.0 quartz 2.3.0: https://mvnrepository.com/artifact/org.quartz-scheduler/quartz/2.3.0, Apache 2.0 quartz-jobs 2.3.0: https://mvnrepository.com/artifact/org.quartz-scheduler/quartz-jobs/2.3.0, Apache 2.0 - resolver 1.5: https://mvnrepository.com/artifact/io.airlift.resolver/resolver/1.5 Apache 2.0 - snakeyaml 1.23: https://mvnrepository.com/artifact/org.yaml/snakeyaml/1.23, Apache 2.0 + snakeyaml 1.28: https://mvnrepository.com/artifact/org.yaml/snakeyaml/1.28, Apache 2.0 snappy 0.2: https://mvnrepository.com/artifact/org.iq80.snappy/snappy/0.2, Apache 2.0 snappy-java 1.0.4.1: https://github.com/xerial/snappy-java, Apache 2.0 SparseBitSet 1.2: https://mvnrepository.com/artifact/com.zaxxer/SparseBitSet, Apache 2.0 - spring-aop 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-aop/5.1.19.RELEASE, Apache 2.0 - spring-beans 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-beans/5.1.19.RELEASE, Apache 2.0 - spring-boot 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot/2.1.18.RELEASE, Apache 2.0 - spring-boot-autoconfigure 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-aop 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-jdbc 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-jetty 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-json 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-json/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-logging 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-logging/2.1.18.RELEASE, Apache 2.0 - spring-boot-starter-web 2.1.18.RELEASE: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/2.1.18.RELEASE, Apache 2.0 - spring-context 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-context/5.1.19.RELEASE, Apache 2.0 - spring-core 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-core, Apache 2.0 - spring-expression 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-expression, Apache 2.0 + spring-aop 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-aop/5.3.12, Apache 2.0 + spring-beans 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-beans/5.3.12, Apache 2.0 + spring-boot 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot/2.5.6, Apache 2.0 + spring-boot-actuator 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-actuator/2.5.6, Apache 2.0 + spring-boot-actuator-autoconfigure 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-actuator-autoconfigure/2.5.6, Apache 2.0 + spring-boot-configuration-processor 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor/2.5.6, Apache 2.0 + spring-boot-autoconfigure 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure/2.5.6, Apache 2.0 + spring-boot-starter 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter/2.5.6, Apache 2.0 + spring-boot-starter-actuator 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator/2.5.6, Apache 2.0 + spring-boot-starter-aop 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop/2.5.6, Apache 2.0 + spring-boot-starter-jdbc 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc/2.5.6, Apache 2.0 + spring-boot-starter-jetty 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty/2.5.6, Apache 2.0 + spring-boot-starter-json 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-json/2.5.6, Apache 2.0 + spring-boot-starter-logging 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-logging/2.5.6, Apache 2.0 + spring-boot-starter-quartz 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-quartz/2.5.6, Apache 2.0 + spring-boot-starter-web 2.5.6: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/2.5.6, Apache 2.0 + spring-context 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-context/5.3.12, Apache 2.0 + spring-context-support 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-context-support/5.3.12, Apache 2.0 + spring-core 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-core, Apache 2.0 + spring-expression 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-expression, Apache 2.0 springfox-core 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-core, Apache 2.0 springfox-schema 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-schema, Apache 2.0 springfox-spi 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-spi, Apache 2.0 @@ -394,29 +380,28 @@ The text of each license is also included at licenses/LICENSE-[project].txt. springfox-swagger2 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-swagger2/2.9.2, Apache 2.0 springfox-swagger-common 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-swagger-common/2.9.2, Apache 2.0 springfox-swagger-ui 2.9.2: https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui/2.9.2, Apache 2.0 - spring-jcl 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-jcl/5.1.19.RELEASE, Apache 2.0 - spring-jdbc 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-jdbc/5.1.19.RELEASE, Apache 2.0 + spring-jcl 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-jcl/5.3.12, Apache 2.0 + spring-jdbc 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-jdbc/5.3.12, Apache 2.0 spring-plugin-core 1.2.0.RELEASE: https://mvnrepository.com/artifact/org.springframework.plugin/spring-plugin-core/1.2.0.RELEASE, Apache 2.0 spring-plugin-metadata 1.2.0.RELEASE: https://mvnrepository.com/artifact/org.springframework.plugin/spring-plugin-metadata/1.2.0.RELEASE, Apache 2.0 - spring-tx 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-tx/5.1.19.RELEASE, Apache 2.0 - spring-web 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-web/5.1.19.RELEASE, Apache 2.0 - spring-webmvc 5.1.19.RELEASE: https://mvnrepository.com/artifact/org.springframework/spring-webmvc/5.1.19.RELEASE, Apache 2.0 + spring-tx 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-tx/5.3.12, Apache 2.0 + spring-web 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-web/5.3.12, Apache 2.0 + spring-webmvc 5.3.12: https://mvnrepository.com/artifact/org.springframework/spring-webmvc/5.3.12, Apache 2.0 swagger-annotations 1.5.20: https://mvnrepository.com/artifact/io.swagger/swagger-annotations/1.5.20, Apache 2.0 swagger-bootstrap-ui 1.9.3: https://mvnrepository.com/artifact/com.github.xiaoymin/swagger-bootstrap-ui/1.9.3, Apache 2.0 swagger-models 1.5.24: https://mvnrepository.com/artifact/io.swagger/swagger-models/1.5.24, Apache 2.0 tephra-api 0.6.0: https://mvnrepository.com/artifact/co.cask.tephra/tephra-api/0.6.0, Apache 2.0 - validation-api 2.0.1.Final: https://mvnrepository.com/artifact/javax.validation/validation-api/2.0.1.Final, Apache 2.0 - wagon-provider-api 2.2: https://mvnrepository.com/artifact/org.apache.maven.wagon/wagon-provider-api/2.2, Apache 2.0 - xbean-reflect 3.4: https://mvnrepository.com/artifact/org.apache.xbean/xbean-reflect/3.4, Apache 2.0 + tomcat-embed-el 9.0.54: https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el/9.0.54, Apache 2.0 xercesImpl 2.9.1: https://mvnrepository.com/artifact/xerces/xercesImpl/2.9.1, Apache 2.0 xmlbeans 3.1.0: https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans/3.1.0, Apache 2.0 - xml-apis 1.4.01: https://mvnrepository.com/artifact/xml-apis/xml-apis/1.4.01, Apache 2.0 and W3C + xml-apis 1.3.04: https://mvnrepository.com/artifact/xml-apis/xml-apis/1.3.04, Apache 2.0 and W3C zookeeper 3.4.14: https://mvnrepository.com/artifact/org.apache.zookeeper/zookeeper/3.4.14, Apache 2.0 presto-jdbc 0.238.1 https://mvnrepository.com/artifact/com.facebook.presto/presto-jdbc/0.238.1 protostuff-core 1.7.2: https://github.com/protostuff/protostuff/protostuff-core Apache-2.0 protostuff-runtime 1.7.2: https://github.com/protostuff/protostuff/protostuff-core Apache-2.0 protostuff-api 1.7.2: https://github.com/protostuff/protostuff/protostuff-api Apache-2.0 protostuff-collectionschema 1.7.2: https://github.com/protostuff/protostuff/protostuff-collectionschema Apache-2.0 + prometheus client_java(simpleclient) 0.12.0: https://github.com/prometheus/client_java, Apache 2.0 snowflake snowflake-2010: https://github.com/twitter-archive/snowflake/tree/snowflake-2010, Apache 2.0 ======================================================================== @@ -437,8 +422,8 @@ The text of each license is also included at licenses/LICENSE-[project].txt. paranamer 2.3: https://mvnrepository.com/artifact/com.thoughtworks.paranamer/paranamer/2.3, BSD threetenbp 1.3.6: https://mvnrepository.com/artifact/org.threeten/threetenbp/1.3.6, BSD 3-clause xmlenc 0.52: https://mvnrepository.com/artifact/xmlenc/xmlenc/0.52, BSD - hamcrest-core 1.3: https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/1.3, BSD 2-Clause - + py4j 0.10.9: https://mvnrepository.com/artifact/net.sf.py4j/py4j/0.10.9, BSD 2-clause + LatencyUtils 2.0.3: https://github.com/LatencyUtils/LatencyUtils, BSD-2-Clause ======================================================================== CDDL licenses @@ -459,9 +444,9 @@ The text of each license is also included at licenses/LICENSE-[project].txt. jersey-guice 1.9: https://mvnrepository.com/artifact/com.sun.jersey.contribs/jersey-guice/1.9, CDDL 1.1 and GPL 1.1 jersey-json 1.9: https://mvnrepository.com/artifact/com.sun.jersey/jersey-json/1.9, CDDL 1.1 and GPL 1.1 jersey-server 1.9: https://mvnrepository.com/artifact/com.sun.jersey/jersey-server/1.9, CDDL 1.1 and GPL 1.1 - jta 1.1: https://mvnrepository.com/artifact/javax.transaction/jta/1.1, CDDL 1.0 transaction-api 1.1: https://mvnrepository.com/artifact/javax.transaction/transaction-api/1.1, CDDL 1.0 + javax.el 3.0.0: https://mvnrepository.com/artifact/org.glassfish/javax.el/3.0.0, CDDL and GPL and GPL 2.0 ======================================================================== EPL licenses @@ -469,17 +454,10 @@ EPL licenses The following components are provided under the EPL License. See project link for details. The text of each license is also included at licenses/LICENSE-[project].txt. - aether-api 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-api/1.13.1, EPL 1.0 - aether-connector-asynchttpclient 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-connector-asynchttpclient/1.13.1, EPL 1.0 - aether-connector-file 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-connector-file/1.13.1, EPL 1.0 - aether-impl 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-impl/1.13.1, EPL 1.0 - aether-spi 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-spi/1.13.1, EPL 1.0 - aether-util 1.13.1: https://mvnrepository.com/artifact/org.sonatype.aether/aether-util/1.13.1, EPL 1.0 - aspectjweaver 1.9.6:https://mvnrepository.com/artifact/org.aspectj/aspectjweaver/1.9.6, EPL 1.0 + aspectjweaver 1.9.7:https://mvnrepository.com/artifact/org.aspectj/aspectjweaver/1.9.7, EPL 1.0 logback-classic 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic/1.2.3, EPL 1.0 and LGPL 2.1 logback-core 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-core/1.2.3, EPL 1.0 and LGPL 2.1 oshi-core 3.9.1: https://mvnrepository.com/artifact/com.github.oshi/oshi-core/3.9.1, EPL 1.0 - junit 4.12: https://mvnrepository.com/artifact/junit/junit/4.12, EPL 1.0 h2-1.4.200 https://github.com/h2database/h2database/blob/master/LICENSE.txt, MPL 2.0 or EPL 1.0 ======================================================================== @@ -489,7 +467,7 @@ MIT licenses The following components are provided under a MIT 2.0 license. See project link for details. The text of each license is also included at licenses/LICENSE-[project].txt. - jul-to-slf4j 1.7.30: https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j/1.7.30, MIT + jul-to-slf4j 1.7.32: https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j/1.7.32, MIT mssql-jdbc 6.1.0.jre8: https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc/6.1.0.jre8, MIT slf4j-api 1.7.5: https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.5, MIT animal-sniffer-annotations 1.14 https://mvnrepository.com/artifact/org.codehaus.mojo/animal-sniffer-annotations/1.14, MIT @@ -517,6 +495,11 @@ WTFPL License ======================================== reflections 0.9.12: https://github.com/ronmamo/reflections WTFPL +======================================== +CC0-1.0 licenses +======================================== + +HdrHistogram 2.1.12: https://github.com/HdrHistogram/HdrHistogram , CC0-1.0 and BSD 2-Clause ======================================================================== UI related licenses diff --git a/dolphinscheduler-dist/release-docs/NOTICE b/dolphinscheduler-dist/release-docs/NOTICE index 2e638696e1..6981f24972 100644 --- a/dolphinscheduler-dist/release-docs/NOTICE +++ b/dolphinscheduler-dist/release-docs/NOTICE @@ -31,23 +31,6 @@ Jetty may be distributed under either license. ------ -plexus-cipher - -The code in this component contains a class - Base64 taken from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/Base64.java -which is Apache license: http://www.apache.org/licenses/LICENSE-2.0 - -The PBE key processing routine PBECipher.createCipher() is adopted from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/OpenSSL.java - which is also Apache APL-2.0 license: http://www.apache.org/licenses/LICENSE-2.0 - ------- -plexus-utils - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - ------- - - Eclipse The following artifacts are EPL. @@ -129,11 +112,6 @@ org.mortbay.jasper:apache-jsp org.apache.tomcat:tomcat-util-scan org.apache.tomcat:tomcat-util -org.mortbay.jasper:apache-el - org.apache.tomcat:tomcat-jasper-el - org.apache.tomcat:tomcat-el-api - - ------ Mortbay @@ -364,14 +342,6 @@ can be obtained at: * HOMEPAGE: * http://logging.apache.org/log4j/ -This product optionally depends on 'Aalto XML', an ultra-high performance -non-blocking XML processor, which can be obtained at: - - * LICENSE: - * license/LICENSE.aalto-xml.txt (Apache License 2.0) - * HOMEPAGE: - * http://wiki.fasterxml.com/AaltoHome - This product contains a modified version of 'HPACK', a Java implementation of the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: @@ -461,12 +431,6 @@ Copyright 2009-2014 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -This product includes software components originally -developed for Airlift (https://github.com/airlift/airlift), -licensed under the Apache 2.0 license. The licensing terms -for Airlift code can be found at: -https://github.com/airlift/airlift/blob/master/LICENSE - ======================================================================== @@ -1695,14 +1659,6 @@ can be obtained at: * HOMEPAGE: * http://logging.apache.org/log4j/ -This product optionally depends on 'Aalto XML', an ultra-high performance -non-blocking XML processor, which can be obtained at: - - * LICENSE: - * license/LICENSE.aalto-xml.txt (Apache License 2.0) - * HOMEPAGE: - * http://wiki.fasterxml.com/AaltoHome - This product contains a modified version of 'HPACK', a Java implementation of the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at: @@ -2054,6 +2010,3 @@ Xmlbeans NOTICE - W3C XML Schema documents Copyright 2001-2003 (c) World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University) - - - resolver.jar from Apache Xml Commons project, - Copyright (c) 2001-2003 Apache Software Foundation diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-LatencyUtils.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-LatencyUtils.txt new file mode 100644 index 0000000000..3405c711ae --- /dev/null +++ b/dolphinscheduler-dist/release-docs/licenses/LICENSE-LatencyUtils.txt @@ -0,0 +1,38 @@ + * This code was Written by Gil Tene of Azul Systems, and released to the + * public domain, as explained at http://creativecommons.org/publicdomain/zero/1.0/ + + For users of this code who wish to consume it under the "BSD" license + rather than under the public domain or CC0 contribution text mentioned + above, the code found under this directory is *also* provided under the + following license (commonly referred to as the BSD 2-Clause License). This + license does not detract from the above stated release of the code into + the public domain, and simply represents an additional license granted by + the Author. + + ----------------------------------------------------------------------------- + ** Beginning of "BSD 2-Clause License" text. ** + + Copyright (c) 2012, 2013, 2014 Gil Tene + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-api.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-api.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-asynchttpclient.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-asynchttpclient.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-asynchttpclient.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-file.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-file.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-connector-file.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-impl.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-impl.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-impl.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-spi.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-spi.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-spi.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-util.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-util.txt deleted file mode 100644 index 3fa00836fa..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-aether-util.txt +++ /dev/null @@ -1,86 +0,0 @@ -Eclipse Public License - v 1.0 -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - -c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-apache-el.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-apache-el.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-apache-el.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-async-http-client.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-async-http-client.txt deleted file mode 100644 index 84fcbc259f..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-async-http-client.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2014-2016 AsyncHttpClient Project - -Licensed 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. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-hamcrest-core.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-hamcrest-core.txt deleted file mode 100644 index 60125b680e..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-hamcrest-core.txt +++ /dev/null @@ -1,27 +0,0 @@ -BSD License - -Copyright (c) 2000-2006, www.hamcrest.org -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. Redistributions in binary form must reproduce -the above copyright notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the distribution. - -Neither the name of Hamcrest nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-hibernate-validator.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-hibernate-validator.txt deleted file mode 100644 index 6b0b1270ff..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-hibernate-validator.txt +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.activation-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.activation-api.txt deleted file mode 100644 index 2c3350791e..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.activation-api.txt +++ /dev/null @@ -1,758 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 - -1. Definitions. - - 1.1. "Contributor" means each individual or entity that creates or - contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Software, prior Modifications used by a Contributor (if any), and - the Modifications made by that particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or (b) - Modifications, or (c) the combination of files containing Original - Software with files containing Modifications, in each case including - portions thereof. - - 1.4. "Executable" means the Covered Software in any form other than - Source Code. - - 1.5. "Initial Developer" means the individual or entity that first - makes Original Software available under this License. - - 1.6. "Larger Work" means a work which combines Covered Software or - portions thereof with code not governed by the terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable form of - any of the following: - - A. Any file that results from an addition to, deletion from or - modification of the contents of a file containing Original Software - or previous Modifications; - - B. Any new file that contains any part of the Original Software or - previous Modification; or - - C. Any new file that is contributed or otherwise made available - under the terms of this License. - - 1.10. "Original Software" means the Source Code and Executable form - of computer software code that is originally released under this - License. - - 1.11. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer software - code in which modifications are made and (b) associated - documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, - this License. For legal entities, "You" includes any entity which - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, the Initial Developer - hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer, to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Software (or portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of - Original Software, to make, have made, use, practice, sell, and - offer for sale, and/or otherwise dispose of the Original Software - (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on - the date Initial Developer first distributes or otherwise makes the - Original Software available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: (1) for code that You delete from the Original Software, or - (2) for infringements caused by: (i) the modification of the - Original Software, or (ii) the combination of the Original Software - with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject - to third party intellectual property claims, each Contributor hereby - grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as Covered Software - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling - of Modifications made by that Contributor either alone and/or in - combination with its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, have made, and/or - otherwise dispose of: (1) Modifications made by that Contributor (or - portions thereof); and (2) the combination of Modifications made by - that Contributor with its Contributor Version (or portions of such - combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective - on the date Contributor first distributes or otherwise makes the - Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: (1) for any code that Contributor has deleted from the - Contributor Version; (2) for infringements caused by: (i) third - party modifications of Contributor Version, or (ii) the combination - of Modifications made by that Contributor with other software - (except as part of the Contributor Version) or other devices; or (3) - under Patent Claims infringed by Covered Software in the absence of - Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available - in Executable form must also be made available in Source Code form - and that Source Code form must be distributed only under the terms - of this License. You must include a copy of this License with every - copy of the Source Code form of the Covered Software You distribute - or otherwise make available. You must inform recipients of any such - Covered Software in Executable form as to how they can obtain such - Covered Software in Source Code form in a reasonable manner on or - through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are - governed by the terms of this License. You represent that You - believe Your Modifications are Your original creation(s) and/or You - have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that - identifies You as the Contributor of the Modification. You may not - remove or alter any copyright, patent or trademark notices contained - within the Covered Software, or any notices of licensing or any - descriptive text giving attribution to any Contributor or the - Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in - Source Code form that alters or restricts the applicable version of - this License or the recipients' rights hereunder. You may choose to - offer, and to charge a fee for, warranty, support, indemnity or - liability obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on behalf of - the Initial Developer or any Contributor. You must make it - absolutely clear that any such warranty, support, indemnity or - liability obligation is offered by You alone, and You hereby agree - to indemnify the Initial Developer and every Contributor for any - liability incurred by the Initial Developer or such Contributor as a - result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under - the terms of this License or under the terms of a license of Your - choice, which may contain terms different from this License, - provided that You are in compliance with the terms of this License - and that the license for the Executable form does not attempt to - limit or alter the recipient's rights in the Source Code form from - the rights set forth in this License. If You distribute the Covered - Software in Executable form under a different license, You must make - it absolutely clear that any terms which differ from this License - are offered by You alone, not by the Initial Developer or - Contributor. You hereby agree to indemnify the Initial Developer and - every Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with - other code not governed by the terms of this License and distribute - the Larger Work as a single product. In such a case, You must make - sure the requirements of this License are fulfilled for the Covered - Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or - new versions of this License from time to time. Each version will be - given a distinguishing version number. Except as provided in Section - 4.3, no one other than the license steward has the right to modify - this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the - Covered Software available under the terms of the version of the - License under which You originally received the Covered Software. If - the Initial Developer includes a notice in the Original Software - prohibiting it from being distributed or otherwise made available - under any subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the version - of the License under which You originally received the Covered - Software. Otherwise, You may also choose to use, distribute or - otherwise make the Covered Software available under the terms of any - subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new - license for Your Original Software, You may create and use a - modified version of this License if You: (a) rename the license and - remove any references to the name of the license steward (except to - note that the license differs from this License); and (b) otherwise - make it clear that the license contains terms which differ from this - License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE - IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR - NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE - DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY - OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, - REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN - ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS - AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to - cure such breach within 30 days of becoming aware of the breach. - Provisions which, by their nature, must remain in effect beyond the - termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or a - Contributor (the Initial Developer or Contributor against whom You - assert such claim is referred to as "Participant") alleging that the - Participant Software (meaning the Contributor Version where the - Participant is a Contributor or the Original Software where the - Participant is the Initial Developer) directly or indirectly - infringes any patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial Developer (if the - Initial Developer is not the Participant) and all Contributors under - Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice - from Participant terminate prospectively and automatically at the - expiration of such 60 day notice period, unless if within such 60 - day period You withdraw Your claim with respect to the Participant - Software against such Participant either unilaterally or pursuant to - a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant - alleging that the Participant Software directly or indirectly - infringes any patent where such claim is resolved (such as by - license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, - all end user licenses that have been validly granted by You or any - distributor hereunder prior to termination (excluding licenses - granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE - TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER - FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR - LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE - POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT - APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH - PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH - LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR - LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION - AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is defined - in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" (as that term is defined at 48 C.F.R. ? 252.227-7014(a)(1)) and "commercial computer software documentation" - as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent - with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 - (June 1995), all U.S. Government End Users acquire Covered Software - with only those rights set forth herein. This U.S. Government Rights - clause is in lieu of, and supersedes, any other FAR, DFAR, or other - clause or provision that addresses Government rights in computer - software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - the law of the jurisdiction specified in a notice contained within - the Original Software (except to the extent applicable law, if any, - provides otherwise), excluding such jurisdiction's conflict-of-law - provisions. Any litigation relating to this License shall be subject - to the jurisdiction of the courts located in the jurisdiction and - venue specified in a notice contained within the Original Software, - with the losing party responsible for costs, including, without - limitation, court costs and reasonable attorneys' fees and expenses. - The application of the United Nations Convention on Contracts for - the International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall be - construed against the drafter shall not apply to this License. You - agree that You alone are responsible for compliance with the United - States export administration regulations (and the export control - laws and regulation of any other countries) when You use, distribute - or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - ------------------------------------------------------------------------- - -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION -LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the -State of California (excluding conflict-of-law provisions). Any -litigation relating to this License shall be subject to the jurisdiction -of the Federal Courts of the Northern District of California and the -state courts of the State of California, with venue lying in Santa Clara -County, California. - - - - The GNU General Public License (GPL) Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor -Boston, MA 02110-1335 -USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to -make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and -to any other program whose authors commit to using it. (Some other Free -Software Foundation software is covered by the GNU Library General -Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. -Our General Public Licenses are designed to make sure that you have the -freedom to distribute copies of free software (and charge for this -service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone -to deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis -or for a fee, you must give the recipients all the rights that you have. -You must make sure that they, too, receive or can get the source code. -And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - -Finally, any free program is threatened constantly by software patents. -We wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program -proprietary. To prevent this, we have made it clear that any patent must -be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and -modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a -notice placed by the copyright holder saying it may be distributed under -the terms of this General Public License. The "Program", below, refers -to any such program or work, and a "work based on the Program" means -either the Program or any derivative work under copyright law: that is -to say, a work containing the Program or a portion of it, either -verbatim or with modifications and/or translated into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of running -the Program is not restricted, and the output from the Program is -covered only if its contents constitute a work based on the Program -(independent of having been made by running the Program). Whether that -is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice -and disclaimer of warranty; keep intact all the notices that refer to -this License and to the absence of any warranty; and give any other -recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of -it, thus forming a work based on the Program, and copy and distribute -such modifications or work under the terms of Section 1 above, provided -that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any part - thereof, to be licensed as a whole at no charge to all third parties - under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this License. - (Exception: if the Program itself is interactive but does not - normally print such an announcement, your work based on the Program - is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, and -can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based on -the Program, the distribution of the whole must be on the terms of this -License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of a -storage or distribution medium does not bring the other work under the -scope of this License. - -3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your cost - of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed - only for noncommercial distribution and only if you received the - program in object code or executable form with such an offer, in - accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source code -means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to control -compilation and installation of the executable. However, as a special -exception, the source code distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies the -executable. - -If distribution of executable or object code is made by offering access -to copy from a designated place, then offering equivalent access to copy -the source code from the same place counts as distribution of the source -code, even though third parties are not compelled to copy the source -along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense or distribute the Program is void, and will -automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will -not have their licenses terminated so long as such parties remain in -full compliance. - -5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and all -its terms and conditions for copying, distributing or modifying the -Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further restrictions -on the recipients' exercise of the rights granted herein. You are not -responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot distribute -so as to satisfy simultaneously your obligations under this License and -any other pertinent obligations, then as a consequence you may not -distribute the Program at all. For example, if a patent license would -not permit royalty-free redistribution of the Program by all those who -receive copies directly or indirectly through you, then the only way you -could satisfy both it and this License would be to refrain entirely from -distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is implemented -by public license practices. Many people have made generous -contributions to the wide range of software distributed through that -system in reliance on consistent application of that system; it is up to -the author/donor to decide if he or she is willing to distribute -software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be -a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License may -add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among countries -not thus excluded. In such case, this License incorporates the -limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new -versions of the General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Program does not specify a version -number of this License, you may choose any version ever published by the -Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the -author to ask for permission. For software which is copyrighted by the -Free Software Foundation, write to the Free Software Foundation; we -sometimes make exceptions for this. Our decision will be guided by the -two goals of preserving the free status of all derivatives of our free -software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type - `show w'. This is free software, and you are welcome to redistribute - it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the commands -you use may be called something other than `show w' and `show c'; they -could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (which makes passes at compilers) written by - James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications -with the library. If this is what you want to do, use the GNU Library -General Public License instead of this License. - -# - -Certain source files distributed by Oracle America, Inc. and/or its -affiliates are subject to the following clarification and special -exception to the GPLv2, based on the GNU Project exception for its -Classpath libraries, known as the GNU Classpath Exception, but only -where Oracle has expressly included in the particular source file's -header the words "Oracle designates this particular file as subject to -the "Classpath" exception as provided by Oracle in the LICENSE file -that accompanied this code." - -You should also note that Oracle includes multiple, independent -programs in this software package. Some of those programs are provided -under licenses deemed incompatible with the GPLv2 by the Free Software -Foundation and others. For example, the package includes programs -licensed under the Apache License, Version 2.0. Such programs are -licensed to you under their original licenses. - -Oracle facilitates your further distribution of this package by adding -the Classpath Exception to the necessary parts of its GPLv2 code, which -permits you to use that code in combination with other independent -modules not licensed under the GPLv2. However, note that this would -not permit you to commingle code under an incompatible license with -Oracle's GPLv2 licensed code by, for example, cutting and pasting such -code into a file also containing Oracle's GPLv2 licensed code and then -distributing the result. Additionally, if you were to remove the -Classpath Exception from any of the files to which it applies and -distribute the result, you would likely be required to license some or -all of the other code in that distribution under the GPLv2 as well, and -since the GPLv2 is incompatible with the license terms of some items -included in the distribution by Oracle, removing the Classpath -Exception could therefore effectively compromise your ability to -further distribute the package. - -Proceed with caution and we recommend that you obtain the advice of a -lawyer skilled in open source matters before removing the Classpath -Exception or making modifications to this package which may -subsequently be redistributed and/or involve the use of third party -software. - -CLASSPATH EXCEPTION -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License version 2 cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from or -based on this library. If you modify this library, you may extend this -exception to your version of the library, but you are not obligated to -do so. If you do not wish to do so, delete this exception statement -from your version. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.servlet-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.servlet-api.txt deleted file mode 100644 index a0ccc93564..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-javax.servlet-api.txt +++ /dev/null @@ -1,263 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - -1. Definitions. - - 1.1. Contributor. means each individual or entity that creates or contributes to the creation of Modifications. - - 1.2. Contributor Version. means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. - - 1.3. Covered Software. means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. - - 1.4. Executable. means the Covered Software in any form other than Source Code. - - 1.5. Initial Developer. means the individual or entity that first makes Original Software available under this License. - - 1.6. Larger Work. means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. - - 1.7. License. means this document. - - 1.8. Licensable. means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. - - 1.9. Modifications. means the Source Code and Executable form of any of the following: - - A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; - - B. Any new file that contains any part of the Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made available under the terms of this License. - - 1.10. Original Software. means the Source Code and Executable form of computer software code that is originally released under this License. - - 1.11. Patent Claims. means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. - - 1.12. Source Code. means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. - - 1.13. You. (or .Your.) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, .You. includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, .control. means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. - - 3.2. Modifications. - The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients. rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient.s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. - -4. Versions of the License. - - 4.1. New Versions. - Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. - - 4.2. Effect of New Versions. - You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. - -5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN .AS IS. BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as .Participant.) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY.S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -8. U.S. GOVERNMENT END USERS. - - The Covered Software is a .commercial item,. as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of .commercial computer software. (as that term is defined at 48 C.F.R. ? 252.227-7014(a)(1)) and .commercial computer software documentation. as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. - -9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction.s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys. fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. - -10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. - - NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) - - The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. - - -The GNU General Public License (GPL) Version 2, June 1991 - - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. - - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. - - c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - - Copyright (C) - - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. - - -"CLASSPATH" EXCEPTION TO THE GPL VERSION 2 - -Certain source files distributed by Sun Microsystems, Inc. are subject to the following clarification and special exception to the GPL Version 2, but only where Sun has expressly included in the particular source file's header the words - -"Sun designates this particular file as subject to the "Classpath" exception as provided by Sun in the License file that accompanied this code." - -Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License Version 2 cover the whole combination. - -As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module.? An independent module is a module which is not derived from or based on this library.? If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so.? If you do not wish to do so, delete this exception statement from your version. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-jboss-logging.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-jboss-logging.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-jboss-logging.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-junit.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-junit.txt deleted file mode 100644 index cd53fb9fa9..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-junit.txt +++ /dev/null @@ -1,213 +0,0 @@ -JUnit - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - - a) in the case of the initial Contributor, the initial code and - documentation distributed under this Agreement, and - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are -distributed by that particular Contributor. A Contribution 'originates' from a -Contributor if it was added to the Program by such Contributor itself or anyone -acting on such Contributor's behalf. Contributions do not include additions to -the Program which: (i) are separate modules of software distributed in -conjunction with the Program under their own license agreement, and (ii) are -not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or when -combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free copyright license to -reproduce, prepare derivative works of, publicly display, publicly perform, -distribute and sublicense the Contribution of such Contributor, if any, and -such derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free patent license under -Licensed Patents to make, use, sell, offer to sell, import and otherwise -transfer the Contribution of such Contributor, if any, in source code and -object code form. This patent license shall apply to the combination of the -Contribution and the Program if, at the time the Contribution is added by the -Contributor, such addition of the Contribution causes such combination to be -covered by the Licensed Patents. The patent license shall not apply to any -other combinations which include the Contribution. No hardware per se is -licensed hereunder. - - c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are provided by -any Contributor that the Program does not infringe the patent or other -intellectual property rights of any other entity. Each Contributor disclaims -any liability to Recipient for claims brought by any other entity based on -infringement of intellectual property rights or otherwise. As a condition to -exercising the rights and licenses granted hereunder, each Recipient hereby -assumes sole responsibility to secure any other intellectual property rights -needed, if any. For example, if a third party patent license is required to -allow Recipient to distribute the Program, it is Recipient's responsibility to -acquire that license before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright license -set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under -its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for -damages, including direct, indirect, special, incidental and consequential -damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable manner on -or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained within the -Program. - -Each Contributor must identify itself as the originator of its Contribution, if -any, in a manner that reasonably allows subsequent Recipients to identify the -originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, if -a Contributor includes the Program in a commercial product offering, such -Contributor ("Commercial Contributor") hereby agrees to defend and indemnify -every other Contributor ("Indemnified Contributor") against any losses, damages -and costs (collectively "Losses") arising from claims, lawsuits and other legal -actions brought by a third party against the Indemnified Contributor to the -extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may -participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. If that -Commercial Contributor then makes performance claims, or offers warranties -related to Product X, those performance claims and warranties are such -Commercial Contributor's responsibility alone. Under this section, the -Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a court -requires any other Contributor to pay any damages as a result, the Commercial -Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each -Recipient is solely responsible for determining the appropriateness of using -and distributing the Program and assumes all risks associated with its exercise -of rights under this Agreement, including but not limited to the risks and -costs of program errors, compliance with applicable laws, damage to or loss of -data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST -PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS -GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable -law, it shall not affect the validity or enforceability of the remainder of the -terms of this Agreement, and without further action by the parties hereto, such -provision shall be reformed to the minimum extent necessary to make such -provision valid and enforceable. - -If Recipient institutes patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging that the -Program itself (excluding combinations of the Program with other software or -hardware) infringes such Recipient's patent(s), then such Recipient's rights -granted under Section 2(b) shall terminate as of the date such litigation is -filed. - -All Recipient's rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and does -not cure such failure in a reasonable period of time after becoming aware of -such noncompliance. If all Recipient's rights under this Agreement terminate, -Recipient agrees to cease use and distribution of the Program as soon as -reasonably practicable. However, Recipient's obligations under this Agreement -and any licenses granted by Recipient relating to the Program shall continue -and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in -order to avoid inconsistency the Agreement is copyrighted and may only be -modified in the following manner. The Agreement Steward reserves the right to -publish new versions (including revisions) of this Agreement from time to time. -No one other than the Agreement Steward has the right to modify this Agreement. -The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to this -Agreement will bring a legal action under this Agreement more than one year -after the cause of action arose. Each party waives its rights to a jury trial -in any resulting litigation. \ No newline at end of file diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-aether-provider.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-aether-provider.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-aether-provider.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-artifact.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-artifact.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-artifact.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-compat.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-compat.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-compat.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-core.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-core.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-core.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-embedder.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-embedder.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-embedder.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model-builder.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model-builder.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model-builder.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-model.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-plugin-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-plugin-api.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-plugin-api.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-repository-metadata.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-repository-metadata.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-repository-metadata.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings-builder.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings-builder.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings-builder.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-maven-settings.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-cipher.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-cipher.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-cipher.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-classworlds.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-classworlds.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-classworlds.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-component-annotations.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-component-annotations.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-component-annotations.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-container-default.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-container-default.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-container-default.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-interpolation.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-interpolation.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-interpolation.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-sec-dispatcher.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-sec-dispatcher.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-sec-dispatcher.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-utils.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-utils.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-plexus-utils.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-resolver.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-resolver.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-resolver.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-validation-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-validation-api.txt deleted file mode 100644 index babf57d5e0..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-validation-api.txt +++ /dev/null @@ -1,4 +0,0 @@ -Bean Validation API - -License: Apache License, Version 2.0 -See the license.txt file in the root directory or . diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-wagon-provider-api.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-wagon-provider-api.txt deleted file mode 100644 index d645695673..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-wagon-provider-api.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-xmlbeans.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-xmlbeans.txt deleted file mode 100644 index 261eeb9e9f..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-xmlbeans.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/dolphinscheduler-dist/src/main/assembly/dolphinscheduler-bin.xml b/dolphinscheduler-dist/src/main/assembly/dolphinscheduler-bin.xml index c918aefa2a..bbc988b261 100644 --- a/dolphinscheduler-dist/src/main/assembly/dolphinscheduler-bin.xml +++ b/dolphinscheduler-dist/src/main/assembly/dolphinscheduler-bin.xml @@ -28,8 +28,10 @@ - ${basedir}/../dolphinscheduler-alert/src/main/resources + ${basedir}/../dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json @@ -41,19 +43,20 @@ ${basedir}/../dolphinscheduler-api/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json - - application.properties - conf ${basedir}/../dolphinscheduler-common/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json @@ -64,6 +67,8 @@ ${basedir}/../dolphinscheduler-dao/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json @@ -77,6 +82,8 @@ ${basedir}/../dolphinscheduler-server/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json @@ -88,6 +95,8 @@ ${basedir}/../dolphinscheduler-service/src/main/resources + **/*.yaml + **/*.yml **/*.properties **/*.xml **/*.json @@ -97,39 +106,13 @@ - src/main/resources + ${basedir}/../dolphinscheduler-standalone-server/src/main/resources - **/*.properties - **/*.xml - **/*.json + **/*.yaml conf - - ${basedir}/../dolphinscheduler-server/target/dolphinscheduler-server-${project.version} - - **/*.* - - . - - - - ${basedir}/../dolphinscheduler-api/target/dolphinscheduler-api-${project.version} - - **/*.* - - . - - - - ${basedir}/../dolphinscheduler-alert/target/dolphinscheduler-alert-${project.version} - - **/*.* - - . - - ${basedir}/../dolphinscheduler-dist/target/dolphinscheduler-dist-${project.version} @@ -147,11 +130,11 @@ - ${basedir}/../sql + ${basedir}/../dolphinscheduler-dao/src/main/resources/sql **/* - ./sql + ./sql/sql @@ -167,7 +150,7 @@ env/*.* - ./conf + conf @@ -186,7 +169,6 @@ *.sh *.py - DISCLAIMER . diff --git a/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml b/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml index d7119d009b..739e3c26df 100644 --- a/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml +++ b/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml @@ -33,102 +33,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Event.java b/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Event.java index be781db738..6afa5a2c26 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Event.java +++ b/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Event.java @@ -19,30 +19,107 @@ package org.apache.dolphinscheduler.registry.api; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import lombok.experimental.Accessors; - -@Getter -@Setter -@Builder -@ToString -@NoArgsConstructor -@AllArgsConstructor -@Accessors(fluent = true) public class Event { private String key; private String path; private String data; private Type type; + public Event(String key, String path, String data, Type type) { + this.key = key; + this.path = path; + this.data = data; + this.type = type; + } + + public Event() { + } + + public static EventBuilder builder() { + return new EventBuilder(); + } + + public String key() { + return this.key; + } + + public String path() { + return this.path; + } + + public String data() { + return this.data; + } + + public Type type() { + return this.type; + } + + public Event key(String key) { + this.key = key; + return this; + } + + public Event path(String path) { + this.path = path; + return this; + } + + public Event data(String data) { + this.data = data; + return this; + } + + public Event type(Type type) { + this.type = type; + return this; + } + + public String toString() { + return "Event(key=" + this.key() + ", path=" + this.path() + ", data=" + this.data() + ", type=" + this.type() + ")"; + } + public enum Type { ADD, REMOVE, UPDATE } + + public static class EventBuilder { + private String key; + private String path; + private String data; + private Type type; + + EventBuilder() { + } + + public EventBuilder key(String key) { + this.key = key; + return this; + } + + public EventBuilder path(String path) { + this.path = path; + return this; + } + + public EventBuilder data(String data) { + this.data = data; + return this; + } + + public EventBuilder type(Type type) { + this.type = type; + return this; + } + + public Event build() { + return new Event(key, path, data, type); + } + + public String toString() { + return "Event.EventBuilder(key=" + this.key + ", path=" + this.path + ", data=" + this.data + ", type=" + this.type + ")"; + } + } } diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/pom.xml b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/pom.xml index 58d3f31920..3ab571275f 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/pom.xml +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/pom.xml @@ -61,18 +61,5 @@ curator-test test - - - junit - junit - test - - - - org.jacoco - org.jacoco.agent - runtime - test - diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperConnectionStateListener.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperConnectionStateListener.java index 9526e0e060..7faa3db82b 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperConnectionStateListener.java +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperConnectionStateListener.java @@ -23,14 +23,17 @@ import org.apache.dolphinscheduler.registry.api.ConnectionState; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.state.ConnectionStateListener; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; -@Slf4j -@RequiredArgsConstructor public final class ZookeeperConnectionStateListener implements ConnectionStateListener { + private static final Logger log = org.slf4j.LoggerFactory.getLogger(ZookeeperConnectionStateListener.class); + private final ConnectionListener listener; + public ZookeeperConnectionStateListener(ConnectionListener listener) { + this.listener = listener; + } + @Override public void stateChanged(CuratorFramework client, org.apache.curator.framework.state.ConnectionState newState) { diff --git a/dolphinscheduler-registry/pom.xml b/dolphinscheduler-registry/pom.xml index ff6796cd73..5a0630e8c8 100644 --- a/dolphinscheduler-registry/pom.xml +++ b/dolphinscheduler-registry/pom.xml @@ -29,18 +29,4 @@ dolphinscheduler-registry-api dolphinscheduler-registry-plugins - - - - com.google.auto.service - auto-service - true - - - org.projectlombok - lombok - 1.18.22 - provided - - diff --git a/dolphinscheduler-remote/pom.xml b/dolphinscheduler-remote/pom.xml index 4067fb60ea..6a0d34a18d 100644 --- a/dolphinscheduler-remote/pom.xml +++ b/dolphinscheduler-remote/pom.xml @@ -27,10 +27,6 @@ dolphinscheduler-remote - - UTF-8 - - @@ -66,19 +62,6 @@ reflections - - junit - junit - test - - - - org.jacoco - org.jacoco.agent - runtime - test - - com.google.guava guava diff --git a/dolphinscheduler-server/pom.xml b/dolphinscheduler-server/pom.xml index cd0412c375..7d7add20b3 100644 --- a/dolphinscheduler-server/pom.xml +++ b/dolphinscheduler-server/pom.xml @@ -25,11 +25,7 @@ dolphinscheduler-server dolphinscheduler-server - jar - - UTF-8 - @@ -41,6 +37,51 @@ org.apache.dolphinscheduler dolphinscheduler-spi + + org.apache.dolphinscheduler + dolphinscheduler-task-datax + + + org.apache.dolphinscheduler + dolphinscheduler-task-flink + + + org.apache.dolphinscheduler + dolphinscheduler-task-http + + + org.apache.dolphinscheduler + dolphinscheduler-task-mr + + + org.apache.dolphinscheduler + dolphinscheduler-task-pigeon + + + org.apache.dolphinscheduler + dolphinscheduler-task-procedure + + + org.apache.dolphinscheduler + dolphinscheduler-task-python + + + org.apache.dolphinscheduler + dolphinscheduler-task-shell + + + org.apache.dolphinscheduler + dolphinscheduler-task-spark + + + org.apache.dolphinscheduler + dolphinscheduler-task-sql + + + org.apache.dolphinscheduler + dolphinscheduler-task-sqoop + + org.apache.httpcomponents httpclient @@ -49,11 +90,6 @@ org.apache.httpcomponents httpcore - - junit - junit - test - com.google.guava guava @@ -73,12 +109,6 @@ org.powermock powermock-api-mockito2 test - - - org.mockito - mockito-core - - org.mockito @@ -86,65 +116,30 @@ test - org.jacoco - org.jacoco.agent - runtime + org.springframework + spring-test test - org.springframework - spring-test + org.springframework.boot + spring-boot-test test - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin + maven-jar-plugin - ${java.version} - ${java.version} - ${project.build.sourceEncoding} + + config/ + *.yaml + *.xml + - diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerServer.java index f1999e641c..c7c7761e0c 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerServer.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerServer.java @@ -17,11 +17,11 @@ package org.apache.dolphinscheduler.server.log; - import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class LoggerServer { */ private final LoggerRequestProcessor requestProcessor; - public LoggerServer(){ + public LoggerServer() { this.serverConfig = new NettyServerConfig(); this.serverConfig.setListenPort(Constants.RPC_PORT); this.server = new NettyRemotingServer(serverConfig); @@ -72,7 +72,7 @@ public class LoggerServer { */ public void start() { this.server.start(); - logger.info("logger server started, listening on port : {}" , Constants.RPC_PORT); + logger.info("logger server started, listening on port : {}", Constants.RPC_PORT); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java index 7b2a1cdcbf..176e796aee 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java @@ -53,11 +53,12 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; * master server */ @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { - @ComponentScan.Filter(type = FilterType.REGEX, pattern = { - "org.apache.dolphinscheduler.server.worker.*", - "org.apache.dolphinscheduler.server.monitor.*", - "org.apache.dolphinscheduler.server.log.*" - }) + @ComponentScan.Filter(type = FilterType.REGEX, pattern = { + "org.apache.dolphinscheduler.server.worker.*", + "org.apache.dolphinscheduler.server.monitor.*", + "org.apache.dolphinscheduler.server.log.*", + "org.apache.dolphinscheduler.alert.*" + }) }) @EnableTransactionManagement public class MasterServer implements IStoppable { diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java index 50d2eabf64..64120f3988 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java @@ -26,47 +26,33 @@ import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager; -import org.apache.dolphinscheduler.server.worker.processor.DBTaskAckProcessor; -import org.apache.dolphinscheduler.server.worker.processor.DBTaskResponseProcessor; -import org.apache.dolphinscheduler.server.worker.processor.HostUpdateProcessor; -import org.apache.dolphinscheduler.server.worker.processor.TaskExecuteProcessor; -import org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor; +import org.apache.dolphinscheduler.server.worker.processor.*; import org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient; import org.apache.dolphinscheduler.server.worker.runner.RetryReportTaskStatusThread; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; -import org.apache.dolphinscheduler.spi.exception.PluginNotFoundException; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; -import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections4.MapUtils; - -import java.util.Set; - -import javax.annotation.PostConstruct; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.transaction.annotation.EnableTransactionManagement; -import com.facebook.presto.jdbc.internal.guava.collect.ImmutableList; +import javax.annotation.PostConstruct; +import java.util.Set; /** * worker server */ @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { - @ComponentScan.Filter(type = FilterType.REGEX, pattern = { - "org.apache.dolphinscheduler.server.master.*", - "org.apache.dolphinscheduler.server.monitor.*", - "org.apache.dolphinscheduler.server.log.*" - }) + @ComponentScan.Filter(type = FilterType.REGEX, pattern = { + "org.apache.dolphinscheduler.server.master.*", + "org.apache.dolphinscheduler.server.monitor.*", + "org.apache.dolphinscheduler.server.log.*", + "org.apache.dolphinscheduler.alert.*" + }) }) @EnableTransactionManagement public class WorkerServer implements IStoppable { @@ -111,6 +97,7 @@ public class WorkerServer implements IStoppable { @Autowired private WorkerRegistryClient workerRegistryClient; + @Autowired private TaskPluginManager taskPluginManager; /** @@ -120,7 +107,9 @@ public class WorkerServer implements IStoppable { */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); - new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); + new SpringApplicationBuilder(WorkerServer.class) + .profiles("worker") + .run(args); } /** @@ -131,8 +120,6 @@ public class WorkerServer implements IStoppable { // alert-server client registry alertClientService = new AlertClientService(workerConfig.getAlertListenHost(), Constants.ALERT_RPC_PORT); - // init task plugin - initTaskPlugin(); // init remoting server NettyServerConfig serverConfig = new NettyServerConfig(); serverConfig.setListenPort(workerConfig.getListenPort()); @@ -162,7 +149,7 @@ public class WorkerServer implements IStoppable { // retry report task status this.retryReportTaskStatusThread.start(); - /** + /* * registry hooks, which are called before the process exits */ Runtime.getRuntime().addShutdownHook(new Thread(() -> { @@ -172,32 +159,7 @@ public class WorkerServer implements IStoppable { })); } - // todo better - private void initTaskPlugin() { - taskPluginManager = new TaskPluginManager(); - DolphinPluginManagerConfig taskPluginManagerConfig = new DolphinPluginManagerConfig(); - taskPluginManagerConfig.setPlugins(workerConfig.getTaskPluginBinding()); - if (StringUtils.isNotBlank(workerConfig.getTaskPluginDir())) { - taskPluginManagerConfig.setInstalledPluginsDir(workerConfig.getTaskPluginDir().trim()); - } - - if (StringUtils.isNotBlank(workerConfig.getMavenLocalRepository())) { - taskPluginManagerConfig.setMavenLocalRepository(workerConfig.getMavenLocalRepository().trim()); - } - - DolphinPluginLoader taskPluginLoader = new DolphinPluginLoader(taskPluginManagerConfig, ImmutableList.of(taskPluginManager)); - try { - taskPluginLoader.loadPlugins(); - } catch (Exception e) { - throw new RuntimeException("Load Task Plugin Failed !", e); - } - if (MapUtils.isEmpty(taskPluginManager.getTaskChannelMap())) { - throw new PluginNotFoundException("Task Plugin Not Found,Please Check Config File"); - } - } - public void close(String cause) { - try { // execute only once if (Stopper.isStopped()) { diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java index 9da2181ded..21ab22e4cf 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java @@ -17,90 +17,69 @@ package org.apache.dolphinscheduler.server.worker.plugin; -import static java.lang.String.format; -import static java.util.Objects.requireNonNull; - -import static com.google.common.base.Preconditions.checkState; - import org.apache.dolphinscheduler.common.enums.PluginType; -import org.apache.dolphinscheduler.dao.DaoFactory; import org.apache.dolphinscheduler.dao.PluginDao; import org.apache.dolphinscheduler.dao.entity.PluginDefine; -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.classloader.ThreadContextClassLoader; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; import org.apache.dolphinscheduler.spi.params.base.PluginParams; -import org.apache.dolphinscheduler.spi.plugin.AbstractDolphinPluginManager; import org.apache.dolphinscheduler.spi.task.TaskChannel; import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; -public class TaskPluginManager extends AbstractDolphinPluginManager { +import static java.lang.String.format; +@Component +public class TaskPluginManager { private static final Logger logger = LoggerFactory.getLogger(TaskPluginManager.class); - private final Map taskChannelFactoryMap = new ConcurrentHashMap<>(); private final Map taskChannelMap = new ConcurrentHashMap<>(); - /** - * k->pluginDefineId v->pluginDefineName - */ - private final Map pluginDefineMap = new HashMap<>(); - - private void addTaskChannelFactory(TaskChannelFactory taskChannelFactory) { - requireNonNull(taskChannelFactory, "taskChannelFactory is null"); + private final PluginDao pluginDao; - if (taskChannelFactoryMap.putIfAbsent(taskChannelFactory.getName(), taskChannelFactory) != null) { - throw new IllegalArgumentException(format("Task Plugin '%s' is already registered", taskChannelFactory.getName())); - } + public TaskPluginManager(PluginDao pluginDao) { + this.pluginDao = pluginDao; + } - try { - loadTaskChannel(taskChannelFactory.getName()); - } catch (Exception e) { - throw new IllegalArgumentException(format("Task Plugin '%s' is can not load .", taskChannelFactory.getName())); - } + private void loadTaskChannel(TaskChannelFactory taskChannelFactory) { + TaskChannel taskChannel = taskChannelFactory.create(); + taskChannelMap.put(taskChannelFactory.getName(), taskChannel); } - private void loadTaskChannel(String name) { - requireNonNull(name, "name is null"); + public Map getTaskChannelMap() { + return Collections.unmodifiableMap(taskChannelMap); + } - TaskChannelFactory taskChannelFactory = taskChannelFactoryMap.get(name); - checkState(taskChannelFactory != null, "Task Plugin {} is not registered", name); + @PostConstruct + public void installPlugin() { + final Set names = new HashSet<>(); - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(taskChannelFactory.getClass().getClassLoader())) { - TaskChannel taskChannel = taskChannelFactory.create(); - this.taskChannelMap.put(name, taskChannel); - } + ServiceLoader.load(TaskChannelFactory.class).forEach(factory -> { + final String name = factory.getName(); - logger.info("-- Loaded Task Plugin {} --", name); - } + logger.info("Registering task plugin: {}", name); + if (!names.add(name)) { + throw new IllegalStateException(format("Duplicate task plugins named '%s'", name)); + } - private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); + loadTaskChannel(factory); - public Map getTaskChannelMap() { - return taskChannelMap; - } + logger.info("Registered task plugin: {}", name); - @Override - public void installPlugin(DolphinSchedulerPlugin dolphinSchedulerPlugin) { - for (TaskChannelFactory taskChannelFactory : dolphinSchedulerPlugin.getTaskChannelFactorys()) { - logger.info("Registering Task Plugin '{}'", taskChannelFactory.getName()); - this.addTaskChannelFactory(taskChannelFactory); - List params = taskChannelFactory.getParams(); - String nameEn = taskChannelFactory.getName(); + List params = factory.getParams(); String paramsJson = PluginParamsTransfer.transferParamsToJson(params); - PluginDefine pluginDefine = new PluginDefine(nameEn, PluginType.TASK.getDesc(), paramsJson); - int id = pluginDao.addOrUpdatePluginDefine(pluginDefine); - pluginDefineMap.put(id, pluginDefine.getPluginName()); - } + PluginDefine pluginDefine = new PluginDefine(name, PluginType.TASK.getDesc(), paramsJson); + int count = pluginDao.addOrUpdatePluginDefine(pluginDefine); + if (count <= 0) { + throw new RuntimeException("Failed to update task plugin: " + name); + } + }); } } diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java index a8c823b119..54d96acb91 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java @@ -17,21 +17,16 @@ package org.apache.dolphinscheduler.server.worker.runner; -import static java.util.Calendar.DAY_OF_MONTH; - +import com.github.rholder.retry.RetryException; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang.StringUtils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.Event; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.process.Property; -import org.apache.dolphinscheduler.common.utils.CommonUtils; -import org.apache.dolphinscheduler.common.utils.DateUtils; -import org.apache.dolphinscheduler.common.utils.HadoopUtils; -import org.apache.dolphinscheduler.common.utils.JSONUtils; -import org.apache.dolphinscheduler.common.utils.LoggerUtils; -import org.apache.dolphinscheduler.common.utils.OSUtils; -import org.apache.dolphinscheduler.common.utils.RetryerUtils; +import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.TaskExecuteAckCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand; @@ -41,32 +36,23 @@ import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager; import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.queue.entity.TaskExecutionContext; -import org.apache.dolphinscheduler.spi.exception.PluginNotFoundException; import org.apache.dolphinscheduler.spi.task.AbstractTask; import org.apache.dolphinscheduler.spi.task.TaskAlertInfo; import org.apache.dolphinscheduler.spi.task.TaskChannel; import org.apache.dolphinscheduler.spi.task.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; - -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.Delayed; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.github.rholder.retry.RetryException; +import static java.util.Calendar.DAY_OF_MONTH; /** * task scheduler thread @@ -93,11 +79,6 @@ public class TaskExecuteThread implements Runnable, Delayed { */ private TaskCallbackService taskCallbackService; - /** - * taskExecutionContextCacheManager - */ - private TaskExecutionContextCacheManager taskExecutionContextCacheManager; - /** * alert client server */ @@ -171,7 +152,7 @@ public class TaskExecuteThread implements Runnable, Delayed { TaskChannel taskChannel = taskPluginManager.getTaskChannelMap().get(taskExecutionContext.getTaskType()); if (null == taskChannel) { - throw new PluginNotFoundException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType())); + throw new RuntimeException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType())); } TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class); String taskLogName = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, @@ -182,8 +163,10 @@ public class TaskExecuteThread implements Runnable, Delayed { taskRequest.setTaskLogName(taskLogName); task = taskChannel.createTask(taskRequest); + // task init this.task.init(); + //init varPool this.task.getParameters().setVarPool(taskExecutionContext.getVarPool()); diff --git a/dolphinscheduler-server/src/main/resources/config/install_config.conf b/dolphinscheduler-server/src/main/resources/config/install_config.conf index 96174d9fc4..91d60cf2db 100755 --- a/dolphinscheduler-server/src/main/resources/config/install_config.conf +++ b/dolphinscheduler-server/src/main/resources/config/install_config.conf @@ -102,12 +102,6 @@ registryServers="192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181" # The root of zookeeper, for now DolphinScheduler default registry server is zookeeper. zkRoot="/dolphinscheduler" -# --------------------------------------------------------- -# Alert Server -# --------------------------------------------------------- -# Alert Server plugin dir. DolphinScheduler will find and load the alert plugin jar package from this dir. -alertPluginDir="lib/plugin/alert" - # --------------------------------------------------------- # Worker Task Server # --------------------------------------------------------- diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/WorkflowExecuteThreadTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/WorkflowExecuteThreadTest.java index ffd6a20433..3bd66c6a78 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/WorkflowExecuteThreadTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/WorkflowExecuteThreadTest.java @@ -88,7 +88,6 @@ public class WorkflowExecuteThreadTest { applicationContext = mock(ApplicationContext.class); config = new MasterConfig(); - config.setMasterExecTaskNum(1); Mockito.when(applicationContext.getBean(MasterConfig.class)).thenReturn(config); processInstance = mock(ProcessInstance.class); @@ -111,46 +110,9 @@ public class WorkflowExecuteThreadTest { Field dag = WorkflowExecuteThread.class.getDeclaredField("dag"); dag.setAccessible(true); dag.set(workflowExecuteThread, new DAG()); - PowerMockito.doNothing().when(workflowExecuteThread, "executeProcess"); - PowerMockito.doNothing().when(workflowExecuteThread, "prepareProcess"); - PowerMockito.doNothing().when(workflowExecuteThread, "runProcess"); PowerMockito.doNothing().when(workflowExecuteThread, "endProcess"); } - /** - * without schedule - */ - @Test - public void testParallelWithOutSchedule() throws ParseException { - try { - Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionId)).thenReturn(zeroSchedulerList()); - Method method = WorkflowExecuteThread.class.getDeclaredMethod("executeComplementProcess"); - method.setAccessible(true); - method.invoke(workflowExecuteThread); - // one create save, and 1-30 for next save, and last day 20 no save - verify(processService, times(20)).saveProcessInstance(processInstance); - } catch (Exception e) { - e.printStackTrace(); - Assert.fail(); - } - } - - /** - * with schedule - */ - @Test - public void testParallelWithSchedule() { - try { - Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionId)).thenReturn(oneSchedulerList()); - Method method = WorkflowExecuteThread.class.getDeclaredMethod("executeComplementProcess"); - method.setAccessible(true); - method.invoke(workflowExecuteThread); - // one create save, and 9(1 to 20 step 2) for next save, and last day 31 no save - verify(processService, times(20)).saveProcessInstance(processInstance); - } catch (Exception e) { - Assert.fail(); - } - } @Test public void testParseStartNodeName() throws ParseException { @@ -168,23 +130,6 @@ public class WorkflowExecuteThreadTest { } } - @Test - public void testRetryTaskIntervalOverTime() { - try { - TaskInstance taskInstance = new TaskInstance(); - taskInstance.setId(0); - taskInstance.setMaxRetryTimes(0); - taskInstance.setRetryInterval(0); - taskInstance.setState(ExecutionStatus.FAILURE); - Class masterExecThreadClass = WorkflowExecuteThread.class; - Method method = masterExecThreadClass.getDeclaredMethod("retryTaskIntervalOverTime", TaskInstance.class); - method.setAccessible(true); - Assert.assertTrue((Boolean) method.invoke(workflowExecuteThread, taskInstance)); - } catch (Exception e) { - Assert.fail(); - } - } - @Test public void testGetStartTaskInstanceList() { try { @@ -256,16 +201,4 @@ public class WorkflowExecuteThreadTest { } } - private List zeroSchedulerList() { - return Collections.emptyList(); - } - - private List oneSchedulerList() { - List schedulerList = new LinkedList<>(); - Schedule schedule = new Schedule(); - schedule.setCrontab("0 0 0 1/2 * ?"); - schedulerList.add(schedule); - return schedulerList; - } - -} \ No newline at end of file +} diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumerTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumerTest.java index dd190f771c..f9d51a910e 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumerTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumerTest.java @@ -18,7 +18,6 @@ package org.apache.dolphinscheduler.server.master.consumer; import org.apache.dolphinscheduler.common.enums.CommandType; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.TaskType; @@ -34,6 +33,7 @@ import org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.queue.TaskPriority; import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue; +import org.apache.dolphinscheduler.spi.enums.DbType; import java.util.Date; import java.util.concurrent.TimeUnit; diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessorTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessorTest.java index b4e41cb06a..e7afa143bb 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessorTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessorTest.java @@ -18,7 +18,6 @@ package org.apache.dolphinscheduler.server.master.runner.task; import org.apache.dolphinscheduler.common.enums.CommandType; -import org.apache.dolphinscheduler.common.enums.DbType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.spi.enums.ResourceType; @@ -33,6 +32,7 @@ import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.queue.entity.TaskExecutionContext; +import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.task.request.DataxTaskExecutionContext; import java.util.ArrayList; diff --git a/dolphinscheduler-service/pom.xml b/dolphinscheduler-service/pom.xml index d339f7f47d..3a401b428e 100644 --- a/dolphinscheduler-service/pom.xml +++ b/dolphinscheduler-service/pom.xml @@ -45,30 +45,29 @@ org.apache.dolphinscheduler dolphinscheduler-registry-zookeeper + - org.apache.dolphinscheduler - dolphinscheduler-common + org.springframework.boot + spring-boot-starter-quartz - org.quartz-scheduler quartz - - com.mchange - c3p0 - - - com.mchange - mchange-commons-java - - - com.zaxxer - HikariCP-java6 - + + com.mchange + c3p0 + + + com.mchange + mchange-commons-java + + + com.zaxxer + HikariCP-java6 + - org.quartz-scheduler quartz-jobs @@ -83,23 +82,27 @@ org.powermock powermock-api-mockito2 test - - - org.mockito - mockito-core - - - - - org.mockito - mockito-core - test + - org.jacoco - org.jacoco.agent - runtime - test + io.micrometer + micrometer-core + provided + + + + + org.apache.maven.plugins + maven-jar-plugin + + + *.yaml + *.properties + + + + + diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/DruidConnectionProvider.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/HikariConnectionProvider.java similarity index 78% rename from dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/DruidConnectionProvider.java rename to dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/HikariConnectionProvider.java index 3ac6ccaedc..ec064538a1 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/DruidConnectionProvider.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/HikariConnectionProvider.java @@ -14,24 +14,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.dolphinscheduler.service.quartz; -import com.alibaba.druid.pool.DruidDataSource; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; -import org.quartz.utils.ConnectionProvider; import java.sql.Connection; import java.sql.SQLException; +import org.quartz.utils.ConnectionProvider; + +import com.zaxxer.hikari.HikariDataSource; + /** - * druid connection provider + * hikari connection provider */ -public class DruidConnectionProvider implements ConnectionProvider { +public class HikariConnectionProvider implements ConnectionProvider { - private final DruidDataSource dataSource; + private final HikariDataSource dataSource; - public DruidConnectionProvider(){ - this.dataSource = SpringApplicationContext.getBean(DruidDataSource.class); + public HikariConnectionProvider() { + this.dataSource = SpringApplicationContext.getBean(HikariDataSource.class); } @Override @@ -40,7 +43,7 @@ public class DruidConnectionProvider implements ConnectionProvider { } @Override - public void shutdown() throws SQLException { + public void shutdown() { dataSource.close(); } diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java index 1588907abe..d9d8619e12 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java @@ -175,7 +175,7 @@ public class QuartzExecutors { properties.setProperty(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, conf.getString(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, QUARTZ_CLUSTERCHECKININTERVAL)); properties.setProperty(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, conf.getString(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, QUARTZ_ACQUIRETRIGGERSWITHINLOCK)); properties.setProperty(ORG_QUARTZ_JOBSTORE_DATASOURCE, conf.getString(ORG_QUARTZ_JOBSTORE_DATASOURCE, QUARTZ_DATASOURCE)); - properties.setProperty(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, conf.getString(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, DruidConnectionProvider.class.getName())); + properties.setProperty(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, conf.getString(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, HikariConnectionProvider.class.getName())); schedulerFactory.initialize(properties); scheduler = schedulerFactory.getScheduler(); diff --git a/dolphinscheduler-service/src/main/resources/quartz.properties b/dolphinscheduler-service/src/main/resources/quartz.properties index 93ee71c6a3..5420755fe7 100644 --- a/dolphinscheduler-service/src/main/resources/quartz.properties +++ b/dolphinscheduler-service/src/main/resources/quartz.properties @@ -51,4 +51,4 @@ #============================================================================ # Configure Datasources #============================================================================ -#org.quartz.dataSource.myDs.connectionProvider.class = org.apache.dolphinscheduler.service.quartz.DruidConnectionProvider +#org.quartz.dataSource.myDs.connectionProvider.class = org.apache.dolphinscheduler.service.quartz.HikariConnectionProvider diff --git a/dolphinscheduler-spi/pom.xml b/dolphinscheduler-spi/pom.xml index 1a21502992..18d01fb4c3 100644 --- a/dolphinscheduler-spi/pom.xml +++ b/dolphinscheduler-spi/pom.xml @@ -24,47 +24,25 @@ dolphinscheduler-spi ${project.artifactId} - - UTF-8 - - com.fasterxml.jackson.core jackson-annotations - com.fasterxml.jackson.core jackson-databind - - com.fasterxml.jackson.core - jackson-core - - org.apache.commons commons-collections4 - provided - - - commons-beanutils - commons-beanutils - provided - - - commons-codec - commons-codec - provided org.slf4j slf4j-api - provided com.baomidou @@ -72,44 +50,15 @@ ${mybatis-plus.version} provided - - - junit - junit - test - - - org.jacoco - org.jacoco.agent - runtime - test - com.google.guava guava - provided - - com.google.code.findbugs - jsr305 - + + com.google.code.findbugs + jsr305 + - - org.sonatype.aether - aether-api - provided - - - org.ow2.asm - asm - provided - - - io.airlift.resolver - resolver - provided - - diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/DolphinSchedulerPlugin.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/DolphinSchedulerPlugin.java deleted file mode 100644 index a073c53c8a..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/DolphinSchedulerPlugin.java +++ /dev/null @@ -1,52 +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.dolphinscheduler.spi; - -import static java.util.Collections.emptyList; - -import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -/** - * Dolphinscheduler plugin interface - * All plugin need implements this interface. - * Each plugin needs a factory. This factory has at least two methods. - * one called AlertChannelFactory#getId(), used to return the name of the plugin implementation, - * so that the 'PluginLoad' module can find the plugin implementation class by the name in the configuration file. - * The other method is called create(Map config). This method contains at least one parameter Map config. - * Config contains custom parameters read from the plug-in configuration file. - */ -public interface DolphinSchedulerPlugin { - - /** - * get alert channel factory - * @return alert channel factory - */ - default Iterable getAlertChannelFactorys() { - return emptyList(); - } - - /** - * get task plugin factory - * @return registry factory - */ - default Iterable getTaskChannelFactorys() { - return emptyList(); - } - -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannelFactory.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannelFactory.java deleted file mode 100644 index 8ac27ab309..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannelFactory.java +++ /dev/null @@ -1,33 +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.dolphinscheduler.spi.alert; - -import org.apache.dolphinscheduler.spi.common.UiChannelFactory; - -/** - * Each AlertPlugin need implement this interface - */ -public interface AlertChannelFactory extends UiChannelFactory { - - /** - * The parameters configured in the alert / xxx.properties file will be in the config map - * - * @return AlertChannel - */ - AlertChannel create(); -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertData.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertData.java deleted file mode 100644 index 5e0abf299c..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertData.java +++ /dev/null @@ -1,77 +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.dolphinscheduler.spi.alert; - -/** - * AlertData - */ -public class AlertData { - - /** - * alert primary key - */ - private int id; - /** - * title - */ - private String title; - /** - * content - */ - private String content; - /** - * log - */ - private String log; - - public int getId() { - return id; - } - - public AlertData setId(int id) { - this.id = id; - return this; - } - - public String getTitle() { - return title; - } - - public AlertData setTitle(String title) { - this.title = title; - return this; - } - - public String getContent() { - return content; - } - - public AlertData setContent(String content) { - this.content = content; - return this; - } - - public String getLog() { - return log; - } - - public AlertData setLog(String log) { - this.log = log; - return this; - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertInfo.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertInfo.java deleted file mode 100644 index 8f61fe2f9d..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertInfo.java +++ /dev/null @@ -1,52 +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.dolphinscheduler.spi.alert; - -import java.util.Map; - -/** - * AlertInfo - */ -public class AlertInfo { - - /** - * all params this plugin need is in alertProps - */ - private Map alertParams; - - /** - * the alert content - */ - private AlertData alertData; - - public Map getAlertParams() { - return alertParams; - } - - public void setAlertParams(Map alertParams) { - this.alertParams = alertParams; - } - - public AlertData getAlertData() { - return alertData; - } - - public void setAlertData(AlertData alertData) { - this.alertData = alertData; - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertResult.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertResult.java deleted file mode 100644 index 6ce5425f7f..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertResult.java +++ /dev/null @@ -1,49 +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.dolphinscheduler.spi.alert; - -public class AlertResult { - - private String status; - - private String message; - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public AlertResult(String status, String message) { - this.status = status; - this.message = message; - } - - public AlertResult() { - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/ShowType.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/ShowType.java deleted file mode 100644 index a95e73ff7f..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/ShowType.java +++ /dev/null @@ -1,51 +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.dolphinscheduler.spi.alert; - -/** - * show type for email - * all alert plugin can use ShowType , so let it in spi package - */ -public enum ShowType { - /** - * 0 TABLE; - * 1 TEXT; - * 2 attachment; - * 3 TABLE+attachment; - */ - TABLE(0, "table"), - TEXT(1, "text"), - ATTACHMENT(2, "attachment"), - TABLEATTACHMENT(3, "table attachment"); - - ShowType(int code, String descp) { - this.code = code; - this.descp = descp; - } - - private final int code; - private final String descp; - - public int getCode() { - return code; - } - - public String getDescp() { - return descp; - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/classloader/ThreadContextClassLoader.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/classloader/ThreadContextClassLoader.java deleted file mode 100644 index b905ef72b7..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/classloader/ThreadContextClassLoader.java +++ /dev/null @@ -1,35 +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.dolphinscheduler.spi.classloader; - -import java.io.Closeable; - -public class ThreadContextClassLoader - implements Closeable { - private final ClassLoader threadContextClassLoader; - - public ThreadContextClassLoader(ClassLoader newThreadContextClassLoader) { - this.threadContextClassLoader = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(newThreadContextClassLoader); - } - - @Override - public void close() { - Thread.currentThread().setContextClassLoader(threadContextClassLoader); - } -} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseConnectionParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/BaseConnectionParam.java similarity index 67% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseConnectionParam.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/BaseConnectionParam.java index ab6e4a84ab..b1df15c397 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/BaseConnectionParam.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/BaseConnectionParam.java @@ -15,24 +15,14 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; +package org.apache.dolphinscheduler.spi.datasource; + +import java.util.HashMap; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -/** - * The base model of connection param - *

- * {@link org.apache.dolphinscheduler.common.datasource.clickhouse.ClickhouseConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.db2.Db2ConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.hive.HiveConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.mysql.MysqlConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.oracle.OracleConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.postgresql.PostgreSqlConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.presto.PrestoConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.spark.SparkConnectionParam} - * {@link org.apache.dolphinscheduler.common.datasource.sqlserver.SqlServerConnectionParam} - */ @JsonInclude(Include.NON_NULL) public abstract class BaseConnectionParam implements ConnectionParam { @@ -46,8 +36,16 @@ public abstract class BaseConnectionParam implements ConnectionParam { protected String jdbcUrl; + protected String driverLocation; + + protected String driverClassName; + + protected String validationQuery; + protected String other; + private Map props = new HashMap<>(); + public String getUser() { return user; } @@ -88,6 +86,30 @@ public abstract class BaseConnectionParam implements ConnectionParam { this.jdbcUrl = jdbcUrl; } + public String getDriverLocation() { + return driverLocation; + } + + public void setDriverLocation(String driverLocation) { + this.driverLocation = driverLocation; + } + + public String getDriverClassName() { + return driverClassName; + } + + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + public String getValidationQuery() { + return validationQuery; + } + + public void setValidationQuery(String validationQuery) { + this.validationQuery = validationQuery; + } + public String getOther() { return other; } @@ -95,4 +117,12 @@ public abstract class BaseConnectionParam implements ConnectionParam { public void setOther(String other) { this.other = other; } + + public Map getProps() { + return props; + } + + public void setProps(Map props) { + this.props = props; + } } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/ConnectionParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/ConnectionParam.java similarity index 94% rename from dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/ConnectionParam.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/ConnectionParam.java index d4ec697751..b3eb903dc7 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/datasource/ConnectionParam.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/ConnectionParam.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.common.datasource; +package org.apache.dolphinscheduler.spi.datasource; import java.io.Serializable; diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannel.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannel.java similarity index 81% rename from dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannel.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannel.java index a429a4ca02..5328f9599a 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertChannel.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannel.java @@ -15,14 +15,9 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.spi.alert; +package org.apache.dolphinscheduler.spi.datasource; -/** - * alert channel interface . - * - * @author gaojun - */ -public interface AlertChannel { +public interface DataSourceChannel { - AlertResult process(AlertInfo info); + DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam); } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/ConnectionParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannelFactory.java similarity index 76% rename from dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/ConnectionParam.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannelFactory.java index 46bd979a2d..c947c3a647 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/ConnectionParam.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceChannelFactory.java @@ -15,12 +15,16 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.plugin.task.datasource; +package org.apache.dolphinscheduler.spi.datasource; -import java.io.Serializable; +public interface DataSourceChannelFactory { + /** + * get datasource client + */ + DataSourceChannel create(); -/** - * The model of Datasource Connection param - */ -public interface ConnectionParam extends Serializable { + /** + * get registry component name + */ + String getName(); } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertConstants.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceClient.java similarity index 80% rename from dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertConstants.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceClient.java index b1eee2a0ba..879d198284 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/alert/AlertConstants.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceClient.java @@ -15,10 +15,15 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.spi.alert; +package org.apache.dolphinscheduler.spi.datasource; -public class AlertConstants { +import java.sql.Connection; - /** the field name of alert show type **/ - public static final String SHOW_TYPE = "show_type"; +public interface DataSourceClient { + + void checkClient(); + + void close(); + + Connection getConnection(); } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java index 0c88407a02..3809c52269 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java @@ -22,31 +22,38 @@ import static java.util.stream.Collectors.toMap; import java.util.Arrays; import java.util.Map; +import com.baomidou.mybatisplus.annotation.EnumValue; import com.google.common.base.Functions; public enum DbType { + MYSQL(0, "mysql"), + POSTGRESQL(1, "postgresql"), + HIVE(2, "hive"), + SPARK(3, "spark"), + CLICKHOUSE(4, "clickhouse"), + ORACLE(5, "oracle"), + SQLSERVER(6, "sqlserver"), + DB2(7, "db2"), + PRESTO(8, "presto"), + H2(9, "h2"); - MYSQL(0), - POSTGRESQL(1), - HIVE(2), - SPARK(3), - CLICKHOUSE(4), - ORACLE(5), - SQLSERVER(6), - DB2(7), - PRESTO(8), - H2(9); - - DbType(int code) { + @EnumValue + private final int code; + private final String descp; + + DbType(int code, String descp) { this.code = code; + this.descp = descp; } - private final int code; - public int getCode() { return code; } + public String getDescp() { + return descp; + } + private static final Map DB_TYPE_MAP = Arrays.stream(DbType.values()).collect(toMap(DbType::getCode, Functions.identity())); @@ -56,4 +63,5 @@ public enum DbType { } return null; } + } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/AbstractDolphinPluginManager.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/AbstractDolphinPluginManager.java deleted file mode 100644 index b1d9592e68..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/AbstractDolphinPluginManager.java +++ /dev/null @@ -1,25 +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.dolphinscheduler.spi.plugin; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; - -public abstract class AbstractDolphinPluginManager { - - public abstract void installPlugin(DolphinSchedulerPlugin dolphinSchedulerPlugin); -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginClassLoader.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginClassLoader.java deleted file mode 100644 index 55b7b410ce..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginClassLoader.java +++ /dev/null @@ -1,140 +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.dolphinscheduler.spi.plugin; - -import static java.util.Objects.requireNonNull; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Enumeration; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; - -import com.google.common.collect.ImmutableList; - -class DolphinPluginClassLoader - extends URLClassLoader { - private static final ClassLoader PLATFORM_CLASS_LOADER = findPlatformClassLoader(); - - private final ClassLoader spiClassLoader; - private final List spiPackages; - private final List spiResources; - - DolphinPluginClassLoader( - List urls, - ClassLoader spiClassLoader, - Iterable spiPackages) { - this(urls, - spiClassLoader, - spiPackages, - StreamSupport.stream(spiPackages.spliterator(), false).map(DolphinPluginClassLoader::classNameToResource).collect(Collectors.toList())); - } - - private DolphinPluginClassLoader( - List urls, - ClassLoader spiClassLoader, - Iterable spiPackages, - Iterable spiResources) { - // plugins should not have access to the system (application) class loader - super(urls.toArray(new URL[0]), PLATFORM_CLASS_LOADER); - this.spiClassLoader = requireNonNull(spiClassLoader, "spiClassLoader is null"); - this.spiPackages = ImmutableList.copyOf(spiPackages); - this.spiResources = ImmutableList.copyOf(spiResources); - } - - @Override - protected Class loadClass(String name, boolean resolve) - throws ClassNotFoundException { - // grab the magic lock - synchronized (getClassLoadingLock(name)) { - // Check if class is in the loaded classes cache - Class cachedClass = findLoadedClass(name); - if (cachedClass != null) { - return resolveClass(cachedClass, resolve); - } - - // If this is an SPI class, only check SPI class loader - if (isSpiClass(name)) { - return resolveClass(spiClassLoader.loadClass(name), resolve); - } - - // Look for class locally - return super.loadClass(name, resolve); - } - } - - private Class resolveClass(Class clazz, boolean resolve) { - if (resolve) { - resolveClass(clazz); - } - return clazz; - } - - @Override - public URL getResource(String name) { - // If this is an SPI resource, only check SPI class loader - if (isSpiResource(name)) { - return spiClassLoader.getResource(name); - } - - // Look for resource locally - return super.getResource(name); - } - - @Override - public Enumeration getResources(String name) - throws IOException { - // If this is an SPI resource, use SPI resources - if (isSpiClass(name)) { - return spiClassLoader.getResources(name); - } - - // Use local resources - return super.getResources(name); - } - - private boolean isSpiClass(String name) { - return spiPackages.stream().anyMatch(name::startsWith); - } - - private boolean isSpiResource(String name) { - return spiResources.stream().anyMatch(name::startsWith); - } - - private static String classNameToResource(String className) { - return className.replace('.', '/'); - } - - @SuppressWarnings("JavaReflectionMemberAccess") - private static ClassLoader findPlatformClassLoader() { - try { - // use platform class loader on Java 9 - Method method = ClassLoader.class.getMethod("getPlatformClassLoader"); - return (ClassLoader) method.invoke(null); - } catch (NoSuchMethodException ignored) { - // use null class loader on Java 8 - return null; - } catch (IllegalAccessException | InvocationTargetException e) { - throw new AssertionError(e); - } - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginDiscovery.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginDiscovery.java deleted file mode 100644 index c09bf71da2..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginDiscovery.java +++ /dev/null @@ -1,150 +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.dolphinscheduler.spi.plugin; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static java.nio.file.Files.createDirectories; -import static java.nio.file.Files.walkFileTree; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.UncheckedIOException; -import java.io.Writer; -import java.nio.file.FileVisitResult; -import java.nio.file.Path; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.List; -import java.util.Set; -import java.util.StringJoiner; -import java.util.stream.Collectors; - -import org.objectweb.asm.ClassReader; -import org.sonatype.aether.artifact.Artifact; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.common.io.ByteStreams; - -/** - * The role of this class is to load the plugin class during development - */ -final class DolphinPluginDiscovery { - // Windows: \target\classes, Unix-like: /target/classes - private static final String ARTIFACT_DIR = new StringJoiner(File.separator, File.separator, "") - .add("target").add("classes").toString(); - private static final String JAVA_CLASS_FILE_SUFFIX = ".class"; - - // Windows: "META-INF\services\" + DolphinSchedulerPlugin.class.getName() - // Unix-like: "META-INF/services/" + DolphinSchedulerPlugin.class.getName() - private static final String PLUGIN_SERVICES_FILE = String.join(File.separator, "META-INF", - "services", DolphinSchedulerPlugin.class.getName()); - - private DolphinPluginDiscovery() { - } - - static Set discoverPluginsFromArtifact(Artifact artifact, ClassLoader classLoader) - throws IOException { - if (!artifact.getExtension().equals("dolphinscheduler-plugin")) { - throw new RuntimeException("Unexpected extension for main artifact: " + artifact); - } - - File file = artifact.getFile(); - if (!file.getPath().endsWith(ARTIFACT_DIR)) { - throw new RuntimeException("Unexpected file for main artifact: " + file); - } - if (!file.isDirectory()) { - throw new RuntimeException("Main artifact file is not a directory: " + file); - } - - if (new File(file, PLUGIN_SERVICES_FILE).exists()) { - return ImmutableSet.of(); - } - - return listClasses(file.toPath()).stream() - .filter(name -> classInterfaces(name, classLoader).contains(DolphinSchedulerPlugin.class.getName())) - .collect(Collectors.toSet()); - } - - static void writePluginServices(Iterable plugins, File root) - throws IOException { - Path path = root.toPath().resolve(PLUGIN_SERVICES_FILE); - createDirectories(path.getParent()); - try (Writer out = new OutputStreamWriter(new FileOutputStream(path.toFile()), UTF_8)) { - for (String plugin : plugins) { - out.write(plugin + "\n"); - } - } - } - - private static List listClasses(Path base) - throws IOException { - ImmutableList.Builder list = ImmutableList.builder(); - walkFileTree(base, new SimpleFileVisitor() { - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) { - if (file.getFileName().toString().endsWith(JAVA_CLASS_FILE_SUFFIX)) { - String name = file.subpath(base.getNameCount(), file.getNameCount()).toString(); - list.add(convertClassName(name.substring(0, name.length() - JAVA_CLASS_FILE_SUFFIX.length()))); - } - return FileVisitResult.CONTINUE; - } - }); - return list.build(); - } - - private static List classInterfaces(String name, ClassLoader classLoader) { - ImmutableList.Builder list = ImmutableList.builder(); - ClassReader reader = readClass(name, classLoader); - for (String binaryName : reader.getInterfaces()) { - list.add(javaName(binaryName)); - } - if (reader.getSuperName() != null) { - list.addAll(classInterfaces(javaName(reader.getSuperName()), classLoader)); - } - return list.build(); - } - - private static ClassReader readClass(String name, ClassLoader classLoader) { - try (InputStream in = classLoader.getResourceAsStream(binaryName(name) + JAVA_CLASS_FILE_SUFFIX)) { - if (in == null) { - throw new RuntimeException("Failed to read class: " + name); - } - return new ClassReader(ByteStreams.toByteArray(in)); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - private static String binaryName(String javaName) { - return javaName.replace('.', '/'); - } - - private static String javaName(String binaryName) { - return binaryName.replace('/', '.'); - } - - private static String convertClassName(String pathName) { - return pathName.replace(File.separatorChar, '.'); - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginLoader.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginLoader.java deleted file mode 100644 index 448da7f799..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginLoader.java +++ /dev/null @@ -1,211 +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.dolphinscheduler.spi.plugin; - -import static java.lang.String.format; -import static java.util.Objects.requireNonNull; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.classloader.ThreadContextClassLoader; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.ServiceLoader; -import java.util.Set; -import java.util.stream.Collectors; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonatype.aether.artifact.Artifact; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Ordering; - -import io.airlift.resolver.ArtifactResolver; - -/** - * Plugin Loader - * Load Plugin from pom when development and run server in IDE - * Load Plugin from the plugin directory when running on the server - */ -public class DolphinPluginLoader { - private static final Logger logger = LoggerFactory.getLogger(DolphinPluginLoader.class); - - /** - * All third-party jar packages used in the classes which in spi package need to be add - */ - private static final ImmutableList DOLPHIN_SPI_PACKAGES = ImmutableList.builder() - .add("org.apache.dolphinscheduler.spi.") - .add("com.fasterxml.jackson.") - .add("org.slf4j") - .build(); - - private final File installedPluginsDir; - private final List configPlugins; - private ArtifactResolver resolver = null; - private final List dolphinPluginManagerList; - - public DolphinPluginLoader(DolphinPluginManagerConfig config, List dolphinPluginManagerList) { - installedPluginsDir = config.getInstalledPluginsDir(); - if (config.getPlugins() == null) { - this.configPlugins = ImmutableList.of(); - } else { - this.configPlugins = ImmutableList.copyOf(config.getPlugins()); - } - - this.dolphinPluginManagerList = requireNonNull(dolphinPluginManagerList, "dolphinPluginManagerList is null"); - if (configPlugins != null && configPlugins.size() > 0) { - this.resolver = new ArtifactResolver(config.getMavenLocalRepository(), config.getMavenRemoteRepository()); - } - } - - public void loadPlugins() - throws Exception { - for (File file : listPluginInstanceDirs(installedPluginsDir)) { - if (file.isDirectory()) { - loadPlugin(file.getAbsolutePath()); - } - } - - for (String plugin : configPlugins) { - loadPlugin(plugin); - } - } - - private void loadPlugin(String plugin) - throws Exception { - logger.info("-- Loading plugin {} --", plugin); - URLClassLoader pluginClassLoader = buildPluginClassLoader(plugin); - try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(pluginClassLoader)) { - loadPlugin(pluginClassLoader); - } - logger.info("-- Finished loading plugin {} --", plugin); - } - - private void loadPlugin(URLClassLoader pluginClassLoader) { - ServiceLoader serviceLoader = ServiceLoader.load(DolphinSchedulerPlugin.class, pluginClassLoader); - List plugins = ImmutableList.copyOf(serviceLoader); - Preconditions.checkState(!plugins.isEmpty(), "No service providers the plugin %s", DolphinSchedulerPlugin.class.getName()); - for (DolphinSchedulerPlugin plugin : plugins) { - logger.info("Installing {}", plugin.getClass().getName()); - for (AbstractDolphinPluginManager dolphinPluginManager : dolphinPluginManagerList) { - dolphinPluginManager.installPlugin(plugin); - } - } - } - - private URLClassLoader buildPluginClassLoader(String plugin) - throws Exception { - File file = new File(plugin); - - if (!file.isDirectory() && (file.getName().equals("pom.xml") || file.getName().endsWith(".pom"))) { - return buildPluginClassLoaderFromPom(file); - } - if (file.isDirectory()) { - return buildPluginClassLoaderFromDirectory(file); - } else { - throw new IllegalArgumentException(format("plugin must be a pom file or directory %s .", plugin)); - } - } - - private URLClassLoader buildPluginClassLoaderFromPom(File pomFile) - throws Exception { - List artifacts = resolver.resolvePom(pomFile); - URLClassLoader classLoader = createClassLoader(artifacts, pomFile.getPath()); - - Artifact artifact = artifacts.get(0); - Set plugins = DolphinPluginDiscovery.discoverPluginsFromArtifact(artifact, classLoader); - if (!plugins.isEmpty()) { - DolphinPluginDiscovery.writePluginServices(plugins, artifact.getFile()); - } - - return classLoader; - } - - private URLClassLoader buildPluginClassLoaderFromDirectory(File dir) - throws Exception { - logger.info("Classpath for {}:", dir.getName()); - List urls = new ArrayList<>(); - for (File file : listPluginInstanceJars(dir)) { - logger.info(" {}", file); - urls.add(file.toURI().toURL()); - } - return createClassLoader(urls); - } - - private URLClassLoader createClassLoader(List artifacts, String name) - throws IOException { - logger.info("Classpath for {}:", name); - List urls = new ArrayList<>(); - for (Artifact artifact : sortArtifacts(artifacts)) { - if (artifact.getFile() == null) { - throw new RuntimeException("Could not resolve artifact: " + artifact); - } - File file = artifact.getFile().getCanonicalFile(); - logger.info(" {}", file); - urls.add(file.toURI().toURL()); - } - return createClassLoader(urls); - } - - private URLClassLoader createClassLoader(List urls) { - ClassLoader parent = getClass().getClassLoader(); - return new DolphinPluginClassLoader(urls, parent, DOLPHIN_SPI_PACKAGES); - } - - private static List listPluginInstanceDirs(File installedPluginsDir) { - if (installedPluginsDir != null && installedPluginsDir.isDirectory()) { - File[] files = installedPluginsDir.listFiles(); - if (files != null) { - Optional isNotDir = Arrays.stream(files).filter(file -> !file.isDirectory()).findAny(); - if (isNotDir.isPresent()) { - return ImmutableList.of(installedPluginsDir); - } else { - Arrays.sort(files); - return ImmutableList.copyOf(files); - } - } - } - return ImmutableList.of(); - } - - private static List listPluginInstanceJars(File installedPluginsDir) { - if (installedPluginsDir != null && installedPluginsDir.isDirectory()) { - File[] files = installedPluginsDir.listFiles(); - if (files != null) { - return ImmutableList.copyOf(Arrays.stream(files).filter(file -> file.isFile() && file.getName().endsWith(".jar")) - .collect(Collectors.toList())); - } - } - return ImmutableList.of(); - } - - private static List sortArtifacts(List artifacts) { - List list = new ArrayList<>(artifacts); - list.sort(Ordering.natural().nullsLast().onResultOf(Artifact::getFile)); - return list; - } - -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginManagerConfig.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginManagerConfig.java deleted file mode 100644 index 518f90e810..0000000000 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/plugin/DolphinPluginManagerConfig.java +++ /dev/null @@ -1,119 +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.dolphinscheduler.spi.plugin; - -import static java.lang.String.format; -import static java.util.Objects.requireNonNull; - -import java.io.File; -import java.util.List; - -import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableList; - -/** - * Dolphin Scheduler Plugin Manager Config - */ -public class DolphinPluginManagerConfig { - - /** - * The dir of the Alert Plugin in. - * When AlertServer is running on the server, it will load the Alert Plugin from this directory. - */ - private File installedPluginsDir; - - /** - * The plugin should be load. - * The installedPluginsDir is empty when we development and run server in IDEA. Then we can config which plugin should be load by param name alert.plugin.binding in the alert.properties file - */ - private List plugins; - - /** - * Development, When AlertServer is running on IDE, AlertPluginLoad can load Alert Plugin from local Repository. - */ - private String mavenLocalRepository = System.getProperty("user.home") + "/.m2/repository"; - private List mavenRemoteRepository = ImmutableList.of("http://repo1.maven.org/maven2/"); - - File getInstalledPluginsDir() { - return installedPluginsDir; - } - - /** - * @param pluginDir plugin directory - */ - public void setInstalledPluginsDir(String pluginDir) { - requireNonNull(pluginDir, "pluginDir can not be null"); - File pluginDirFile = new File(pluginDir); - if (!pluginDirFile.exists()) { - throw new IllegalArgumentException(format("plugin dir not exists ! %s", pluginDirFile.getPath())); - } - this.installedPluginsDir = pluginDirFile; - } - - public List getPlugins() { - return plugins; - } - - public DolphinPluginManagerConfig setPlugins(List plugins) { - this.plugins = plugins; - return this; - } - - /** - * When development and run server in IDE, this method can set plugins in alert.properties . - * Then when you start AlertServer in IDE, the plugin can be load. - * eg: - * file: alert.properties - * alert.plugin=\ - * ../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml, \ - * ../dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/pom.xml - * - * @param plugins plugins - * @return DolphinPluginManagerConfig - */ - public DolphinPluginManagerConfig setPlugins(String plugins) { - if (plugins == null) { - this.plugins = null; - } else { - this.plugins = ImmutableList.copyOf(Splitter.on(',').omitEmptyStrings().trimResults().split(plugins)); - } - return this; - } - - String getMavenLocalRepository() { - return mavenLocalRepository; - } - - public void setMavenLocalRepository(String mavenLocalRepository) { - this.mavenLocalRepository = mavenLocalRepository; - } - - List getMavenRemoteRepository() { - return mavenRemoteRepository; - } - - public DolphinPluginManagerConfig setMavenRemoteRepository(List mavenRemoteRepository) { - this.mavenRemoteRepository = mavenRemoteRepository; - return this; - } - - public DolphinPluginManagerConfig setMavenRemoteRepository(String mavenRemoteRepository) { - this.mavenRemoteRepository = ImmutableList.copyOf(Splitter.on(',').omitEmptyStrings().trimResults().split(mavenRemoteRepository)); - return this; - } -} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java index 55f5203967..2da6a2f5b6 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractParameters.java @@ -17,19 +17,13 @@ package org.apache.dolphinscheduler.spi.task; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import org.apache.commons.collections4.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; +import java.util.*; /** * job params related class @@ -140,9 +134,8 @@ public abstract class AbstractParameters implements IParameters { public List> getListMapByString(String json) { List> allParams = new ArrayList<>(); ArrayNode paramsByJson = JSONUtils.parseArray(json); - Iterator listIterator = paramsByJson.iterator(); - while (listIterator.hasNext()) { - Map param = JSONUtils.toMap(listIterator.next().toString(), String.class, String.class); + for (JsonNode jsonNode : paramsByJson) { + Map param = JSONUtils.toMap(jsonNode.toString()); allParams.add(param); } return allParams; diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java index 65266bd5c3..5ec6342e2d 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java @@ -259,7 +259,7 @@ public class TaskConstants { * driver */ public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver"; - public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver"; + public static final String COM_MYSQL_CJ_JDBC_DRIVER = "com.mysql.cj.jdbc.Driver"; public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver"; public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver"; diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/CollectionUtils.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/CollectionUtils.java index d6e148174e..8c848b4e29 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/CollectionUtils.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/CollectionUtils.java @@ -17,18 +17,9 @@ package org.apache.dolphinscheduler.spi.utils; -import org.apache.commons.beanutils.BeanMap; - -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; /** * Provides utility methods and decorators for {@link Collection} instances. @@ -48,118 +39,6 @@ public class CollectionUtils { throw new UnsupportedOperationException("Construct CollectionUtils"); } - /** - * The load factor used when none specified in constructor. - */ - static final float DEFAULT_LOAD_FACTOR = 0.75f; - - /** - * Returns a new {@link Collection} containing a minus a subset of - * b. Only the elements of b that satisfy the predicate - * condition, p are subtracted from a. - * - *

The cardinality of each element e in the returned {@link Collection} - * that satisfies the predicate condition will be the cardinality of e in a - * minus the cardinality of e in b, or zero, whichever is greater.

- *

The cardinality of each element e in the returned {@link Collection} that does not - * satisfy the predicate condition will be equal to the cardinality of e in a.

- * - * @param a the collection to subtract from, must not be null - * @param b the collection to subtract, must not be null - * @param T - * @return a new collection with the results - * @see Collection#removeAll - */ - public static Collection subtract(Set a, Set b) { - return org.apache.commons.collections4.CollectionUtils.subtract(a, b); - } - - public static boolean isNotEmpty(Collection coll) { - return !isEmpty(coll); - } - - public static boolean isEmpty(Collection coll) { - return coll == null || coll.isEmpty(); - } - - /** - * String to map - * - * @param str string - * @param separator separator - * @return string to map - */ - public static Map stringToMap(String str, String separator) { - return stringToMap(str, separator, ""); - } - - /** - * String to map - * - * @param str string - * @param separator separator - * @param keyPrefix prefix - * @return string to map - */ - public static Map stringToMap(String str, String separator, String keyPrefix) { - - Map emptyMap = new HashMap<>(0); - if (StringUtils.isEmpty(str)) { - return emptyMap; - } - if (StringUtils.isEmpty(separator)) { - return emptyMap; - } - String[] strings = str.split(separator); - int initialCapacity = (int)(strings.length / DEFAULT_LOAD_FACTOR) + 1; - Map map = new HashMap<>(initialCapacity); - for (int i = 0; i < strings.length; i++) { - String[] strArray = strings[i].split("="); - if (strArray.length != 2) { - return emptyMap; - } - //strArray[0] KEY strArray[1] VALUE - if (StringUtils.isEmpty(keyPrefix)) { - map.put(strArray[0], strArray[1]); - } else { - map.put(keyPrefix + strArray[0], strArray[1]); - } - } - return map; - } - - /** - * Transform item in collection - * - * @param collection origin collection - * @param transformFunc transform function - * @param origin item type - * @param target type - * @return transform list - */ - public static List transformToList(Collection collection, Function transformFunc) { - if (isEmpty(collection)) { - return new ArrayList<>(); - } - return collection.stream().map(transformFunc).collect(Collectors.toList()); - } - - /** - * Collect collection to map - * - * @param collection origin collection - * @param keyTransformFunction key transform function - * @param target k type - * @param value - * @return map - */ - public static Map collectionToMap(Collection collection, Function keyTransformFunction) { - if (isEmpty(collection)) { - return new HashMap<>(); - } - return collection.stream().collect(Collectors.toMap(keyTransformFunction, Function.identity())); - } - /** * Helper class to easily access cardinality properties of two collections. * @@ -286,35 +165,4 @@ public class CollectionUtils { return count; } - /** - * Removes certain attributes of each object in the list - * - * @param originList origin list - * @param exclusionSet exclusion set - * @param T - * @return removes certain attributes of each object in the list - */ - public static List> getListByExclusion(List originList, Set exclusionSet) { - List> instanceList = new ArrayList<>(); - if (exclusionSet == null) { - exclusionSet = new HashSet<>(); - } - if (originList == null) { - return instanceList; - } - Map instanceMap; - for (T instance : originList) { - BeanMap beanMap = new BeanMap(instance); - instanceMap = new LinkedHashMap<>(16, 0.75f, true); - for (Map.Entry entry : beanMap.entrySet()) { - if (exclusionSet.contains(entry.getKey())) { - continue; - } - instanceMap.put((String) entry.getKey(), entry.getValue()); - } - instanceList.add(instanceMap); - } - return instanceList; - } - } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java index a3a8b77564..de01948269 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/Constants.java @@ -72,4 +72,125 @@ public class Constants { */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; + public static final String SPRING_DATASOURCE_MIN_IDLE = "spring.datasource.minIdle"; + + public static final String SPRING_DATASOURCE_MAX_ACTIVE = "spring.datasource.maxActive"; + + public static final String SPRING_DATASOURCE_TEST_ON_BORROW = "spring.datasource.testOnBorrow"; + + /** + * java.security.krb5.conf + */ + public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; + + /** + * java.security.krb5.conf.path + */ + public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path"; + + /** + * hadoop.security.authentication + */ + public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; + + /** + * hadoop.security.authentication + */ + public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; + + /** + * loginUserFromKeytab user + */ + public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; + + /** + * loginUserFromKeytab path + */ + public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; + + /** + * resource storage type + */ + public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; + + /** + * kerberos + */ + public static final String KERBEROS = "kerberos"; + + /** + * driver + */ + public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver"; + public static final String COM_MYSQL_CJ_JDBC_DRIVER = "com.mysql.cj.jdbc.Driver"; + public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; + public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver"; + public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.OracleDriver"; + public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver"; + public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver"; + + + /** + * validation Query + */ + public static final String POSTGRESQL_VALIDATION_QUERY = "select version()"; + public static final String MYSQL_VALIDATION_QUERY = "select 1"; + public static final String HIVE_VALIDATION_QUERY = "select 1"; + public static final String CLICKHOUSE_VALIDATION_QUERY = "select 1"; + public static final String ORACLE_VALIDATION_QUERY = "select 1 from dual"; + public static final String SQLSERVER_VALIDATION_QUERY = "select 1"; + public static final String DB2_VALIDATION_QUERY = "select 1 from sysibm.sysdummy1"; + public static final String PRESTO_VALIDATION_QUERY = "select 1"; + + /** + * jdbc url + */ + public static final String JDBC_MYSQL = "jdbc:mysql://"; + public static final String JDBC_POSTGRESQL = "jdbc:postgresql://"; + public static final String JDBC_HIVE_2 = "jdbc:hive2://"; + public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://"; + public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@"; + public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//"; + public static final String JDBC_SQLSERVER = "jdbc:sqlserver://"; + public static final String JDBC_DB2 = "jdbc:db2://"; + public static final String JDBC_PRESTO = "jdbc:presto://"; + + + public static final String ADDRESS = "address"; + public static final String DATABASE = "database"; + public static final String JDBC_URL = "jdbcUrl"; + public static final String PRINCIPAL = "principal"; + public static final String OTHER = "other"; + public static final String ORACLE_DB_CONNECT_TYPE = "connectType"; + public static final String KERBEROS_KRB5_CONF_PATH = "javaSecurityKrb5Conf"; + public static final String KERBEROS_KEY_TAB_USERNAME = "loginUserKeytabUsername"; + public static final String KERBEROS_KEY_TAB_PATH = "loginUserKeytabPath"; + + /** + * DOUBLE_SLASH // + */ + public static final String DOUBLE_SLASH = "//"; + + /** + * comma , + */ + public static final String COMMA = ","; + + /** + * COLON : + */ + public static final String COLON = ":"; + + /** + * AT SIGN + */ + public static final String AT_SIGN = "@"; + + /** + * datasource encryption salt + */ + public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; + public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; + public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java index 9e63498645..104e4487b3 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java @@ -20,7 +20,6 @@ package org.apache.dolphinscheduler.spi.utils; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; -import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; @@ -41,7 +40,6 @@ public class DateUtils { static final long C3 = C2 * 1000L; static final long C4 = C3 * 60L; static final long C5 = C4 * 60L; - static final long C6 = C5 * 24L; /** * a default datetime formatter for the timestamp @@ -94,25 +92,6 @@ public class DateUtils { return Date.from(instant); } - /** - * get current date str - * - * @return date string - */ - public static String getCurrentTime() { - return getCurrentTime(Constants.YYYY_MM_DD_HH_MM_SS); - } - - /** - * get the date string in the specified format of the current time - * - * @param format date format - * @return date string - */ - public static String getCurrentTime(String format) { - return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); - } - /** * get the formatted date string * @@ -135,16 +114,6 @@ public class DateUtils { return localDateTime.format(DateTimeFormatter.ofPattern(format)); } - /** - * convert time to yyyy-MM-dd HH:mm:ss format - * - * @param date date - * @return date string - */ - public static String dateToString(Date date) { - return format(date, Constants.YYYY_MM_DD_HH_MM_SS); - } - /** * convert string to date and time * @@ -197,54 +166,6 @@ public class DateUtils { return Math.abs(d1.getTime() - d2.getTime()); } - /** - * get hours between two dates - * - * @param d1 date1 - * @param d2 date2 - * @return differ hours - */ - public static long diffHours(Date d1, Date d2) { - return (long) Math.ceil(diffMin(d1, d2) / 60.0); - } - - /** - * get minutes between two dates - * - * @param d1 date1 - * @param d2 date2 - * @return differ minutes - */ - public static long diffMin(Date d1, Date d2) { - return (long) Math.ceil(differSec(d1, d2) / 60.0); - } - - /** - * get the date of the specified date in the days before and after - * - * @param date date - * @param day day - * @return the date of the specified date in the days before and after - */ - public static Date getSomeDay(Date date, int day) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(Calendar.DATE, day); - return calendar.getTime(); - } - - /** - * get the hour of day. - * - * @param date date - * @return hour of day - */ - public static int getHourIndex(Date date) { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - return calendar.get(Calendar.HOUR_OF_DAY); - } - /** * compare two dates * @@ -266,60 +187,6 @@ public class DateUtils { return stringToDate(schedule); } - /** - * format time to readable - * - * @param ms ms - * @return format time - */ - public static String format2Readable(long ms) { - - long days = MILLISECONDS.toDays(ms); - long hours = MILLISECONDS.toDurationHours(ms); - long minutes = MILLISECONDS.toDurationMinutes(ms); - long seconds = MILLISECONDS.toDurationSeconds(ms); - - return String.format("%02d %02d:%02d:%02d", days, hours, minutes, seconds); - - } - - /** - * format time to duration - * - * @param d1 d1 - * @param d2 d2 - * @return format time - */ - public static String format2Duration(Date d1, Date d2) { - if (d1 == null || d2 == null) { - return null; - } - return format2Duration(differMs(d1, d2)); - } - - /** - * format time to duration - * - * @param ms ms - * @return format time - */ - public static String format2Duration(long ms) { - - long days = MILLISECONDS.toDays(ms); - long hours = MILLISECONDS.toDurationHours(ms); - long minutes = MILLISECONDS.toDurationMinutes(ms); - long seconds = MILLISECONDS.toDurationSeconds(ms); - - StringBuilder strBuilder = new StringBuilder(); - strBuilder = days > 0 ? strBuilder.append(days).append("d").append(" ") : strBuilder; - strBuilder = hours > 0 ? strBuilder.append(hours).append("h").append(" ") : strBuilder; - strBuilder = minutes > 0 ? strBuilder.append(minutes).append("m").append(" ") : strBuilder; - strBuilder = seconds > 0 ? strBuilder.append(seconds).append("s") : strBuilder; - - return strBuilder.toString(); - - } - /** * get monday *

@@ -372,25 +239,6 @@ public class DateUtils { return cal.getTime(); } - /** - * get some hour of day - * - * @param date date - * @param offsetHour hours - * @return some hour of day - */ - public static Date getSomeHourOfDay(Date date, int offsetHour) { - Calendar cal = Calendar.getInstance(); - - cal.setTime(date); - cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + offsetHour); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - - return cal.getTime(); - } - /** * get last day of month * @@ -409,110 +257,18 @@ public class DateUtils { return cal.getTime(); } - /** - * return YYYY-MM-DD 00:00:00 - * - * @param inputDay date - * @return start day - */ - public static Date getStartOfDay(Date inputDay) { - Calendar cal = Calendar.getInstance(); - cal.setTime(inputDay); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - return cal.getTime(); - } - - /** - * return YYYY-MM-DD 23:59:59 - * - * @param inputDay day - * @return end of day - */ - public static Date getEndOfDay(Date inputDay) { - Calendar cal = Calendar.getInstance(); - cal.setTime(inputDay); - cal.set(Calendar.HOUR_OF_DAY, 23); - cal.set(Calendar.MINUTE, 59); - cal.set(Calendar.SECOND, 59); - cal.set(Calendar.MILLISECOND, 999); - return cal.getTime(); - } - - /** - * return YYYY-MM-DD 00:00:00 - * - * @param inputDay day - * @return start of hour - */ - public static Date getStartOfHour(Date inputDay) { - Calendar cal = Calendar.getInstance(); - cal.setTime(inputDay); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - return cal.getTime(); - } - - /** - * return YYYY-MM-DD 23:59:59 - * - * @param inputDay day - * @return end of hour - */ - public static Date getEndOfHour(Date inputDay) { - Calendar cal = Calendar.getInstance(); - cal.setTime(inputDay); - cal.set(Calendar.MINUTE, 59); - cal.set(Calendar.SECOND, 59); - cal.set(Calendar.MILLISECOND, 999); - return cal.getTime(); - } - - /** - * get current date - * - * @return current date - */ - public static Date getCurrentDate() { - return DateUtils.parse(DateUtils.getCurrentTime(), - Constants.YYYY_MM_DD_HH_MM_SS); - } - - public static Date addYears(Date date, int amount) { - return add(date, 1, amount); - } - public static Date addMonths(Date date, int amount) { return add(date, 2, amount); } - public static Date addWeeks(Date date, int amount) { - return add(date, 3, amount); - } - public static Date addDays(Date date, int amount) { return add(date, 5, amount); } - public static Date addHours(Date date, int amount) { - return add(date, 11, amount); - } - public static Date addMinutes(Date date, int amount) { return add(date, 12, amount); } - public static Date addSeconds(Date date, int amount) { - return add(date, 13, amount); - } - - public static Date addMilliseconds(Date date, int amount) { - return add(date, 14, amount); - } - /** * get date * @@ -547,33 +303,6 @@ public class DateUtils { return intervalSeconds - usedTime; } - /** - * get current time stamp : yyyyMMddHHmmssSSS - * - * @return date string - */ - public static String getCurrentTimeStamp() { - return getCurrentTime(Constants.YYYYMMDDHHMMSSSSS); - } - - /** - * transform date to target timezone date - *

e.g. - *

if input date is 2020-01-01 00:00:00 current timezone is CST - *

targetTimezoneId is MST - *

this method will return 2020-01-01 15:00:00 - */ - public static Date getTimezoneDate(Date date, String targetTimezoneId) { - if (StringUtils.isEmpty(targetTimezoneId)) { - return date; - } - - String dateToString = dateToString(date); - LocalDateTime localDateTime = LocalDateTime.parse(dateToString, DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS)); - ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, TimeZone.getTimeZone(targetTimezoneId).toZoneId()); - return Date.from(zonedDateTime.toInstant()); - } - /** * get timezone by timezoneId */ @@ -583,40 +312,4 @@ public class DateUtils { } return TimeZone.getTimeZone(timezoneId); } - - /** - * Time unit representing one thousandth of a second - */ - public static class MILLISECONDS { - - public static long toSeconds(long d) { - return d / (C3 / C2); - } - - public static long toMinutes(long d) { - return d / (C4 / C2); - } - - public static long toHours(long d) { - return d / (C5 / C2); - } - - public static long toDays(long d) { - return d / (C6 / C2); - } - - public static long toDurationSeconds(long d) { - return (d % (C4 / C2)) / (C3 / C2); - } - - public static long toDurationMinutes(long d) { - return (d % (C5 / C2)) / (C4 / C2); - } - - public static long toDurationHours(long d) { - return (d % (C6 / C2)) / (C5 / C2); - } - - } - } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java index ed53cb2625..070e62f5a1 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java @@ -34,18 +34,14 @@ import java.util.TimeZone; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; @@ -169,47 +165,6 @@ public class JSONUtils { return Collections.emptyList(); } - /** - * check json object valid - * - * @param json json - * @return true if valid - */ - public static boolean checkJsonValid(String json) { - - if (StringUtils.isEmpty(json)) { - return false; - } - - try { - objectMapper.readTree(json); - return true; - } catch (IOException e) { - logger.error("check json object valid exception!", e); - } - - return false; - } - - /** - * Method for finding a JSON Object field with specified name in this - * node or its child nodes, and returning value it has. - * If no matching field is found in this node or its descendants, returns null. - * - * @param jsonNode json node - * @param fieldName Name of field to look for - * @return Value of first matching node found, if any; null if none - */ - public static String findValue(JsonNode jsonNode, String fieldName) { - JsonNode node = jsonNode.findValue(fieldName); - - if (node == null) { - return null; - } - - return node.asText(); - } - /** * json to map * {@link #toMap(String, Class, Class)} @@ -221,21 +176,6 @@ public class JSONUtils { return parseObject(json, new TypeReference>() {}); } - /** - * from the key-value generated json to get the str value no matter the real type of value - * @param json the json str - * @param nodeName key - * @return the str value of key - */ - public static String getNodeString(String json, String nodeName) { - try { - JsonNode rootNode = objectMapper.readTree(json); - return rootNode.has(nodeName) ? rootNode.get(nodeName).toString() : ""; - } catch (JsonProcessingException e) { - return ""; - } - } - /** * json to map * @@ -327,18 +267,6 @@ public class JSONUtils { } } - /** - * json serializer - */ - public static class JsonDataSerializer extends JsonSerializer { - - @Override - public void serialize(String value, JsonGenerator gen, SerializerProvider provider) throws IOException { - gen.writeRawValue(value); - } - - } - /** * json data deserializer */ diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/PropertyUtils.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/PropertyUtils.java index 491be64d5d..2b1adffee7 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/PropertyUtils.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/PropertyUtils.java @@ -21,15 +21,13 @@ import static org.apache.dolphinscheduler.spi.utils.Constants.COMMON_PROPERTIES_ import java.io.IOException; import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; -import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PropertyUtils { + private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); private static final Properties properties = new Properties(); @@ -78,7 +76,8 @@ public class PropertyUtils { * @return property value with upper case */ public static String getUpperCaseString(String key) { - return properties.getProperty(key.trim()).toUpperCase(); + String val = getString(key); + return StringUtils.isEmpty(val) ? val : val.toUpperCase(); } /** @@ -89,8 +88,8 @@ public class PropertyUtils { * @return property value */ public static String getString(String key, String defaultVal) { - String val = properties.getProperty(key.trim()); - return val == null ? defaultVal : val; + String val = getString(key); + return StringUtils.isEmpty(val) ? defaultVal : val; } /** @@ -110,7 +109,7 @@ public class PropertyUtils { */ public static int getInt(String key, int defaultValue) { String value = getString(key); - if (value == null) { + if (StringUtils.isEmpty(value)) { return defaultValue; } @@ -129,12 +128,7 @@ public class PropertyUtils { * @return property value */ public static boolean getBoolean(String key) { - String value = properties.getProperty(key.trim()); - if (null != value) { - return Boolean.parseBoolean(value); - } - - return false; + return getBoolean(key, false); } /** @@ -145,116 +139,46 @@ public class PropertyUtils { * @return property value */ public static Boolean getBoolean(String key, boolean defaultValue) { - String value = properties.getProperty(key.trim()); - if (null != value) { - return Boolean.parseBoolean(value); - } - - return defaultValue; + String value = getString(key); + return StringUtils.isEmpty(value) ? defaultValue : Boolean.parseBoolean(value); } /** * get property long value * * @param key key - * @param defaultVal default value - * @return property value - */ - public static long getLong(String key, long defaultVal) { - String val = getString(key); - return val == null ? defaultVal : Long.parseLong(val); - } - - /** - * @param key key - * @return property value - */ - public static long getLong(String key) { - return getLong(key, -1); - } - - /** - * @param key key - * @param defaultVal default value + * @param defaultValue default value * @return property value */ - public static double getDouble(String key, double defaultVal) { - String val = getString(key); - return val == null ? defaultVal : Double.parseDouble(val); - } - - /** - * get array - * - * @param key property name - * @param splitStr separator - * @return property value through array - */ - public static String[] getArray(String key, String splitStr) { + public static long getLong(String key, long defaultValue) { String value = getString(key); - if (value == null) { - return new String[0]; + if (StringUtils.isEmpty(value)) { + return defaultValue; } + try { - String[] propertyArray = value.split(splitStr); - return propertyArray; + return Long.parseLong(value); } catch (NumberFormatException e) { logger.info(e.getMessage(), e); } - return new String[0]; + return defaultValue; } /** * @param key key - * @param type type - * @param defaultValue default value - * @param T - * @return get enum value - */ - public static > T getEnum(String key, Class type, - T defaultValue) { - String val = getString(key); - return val == null ? defaultValue : Enum.valueOf(type, val); - } - - /** - * get all properties with specified prefix, like: fs. - * - * @param prefix prefix to search - * @return all properties with specified prefix + * @return property value */ - public static Map getPrefixedProperties(String prefix) { - Map matchedProperties = new HashMap<>(); - for (String propName : properties.stringPropertyNames()) { - if (propName.startsWith(prefix)) { - matchedProperties.put(propName, properties.getProperty(propName)); - } - } - return matchedProperties; + public static long getLong(String key) { + return getLong(key, -1); } /** - * + * set value + * @param key key + * @param value value */ public static void setValue(String key, String value) { properties.setProperty(key, value); } - public static Map getPropertiesByPrefix(String prefix) { - if (StringUtils.isEmpty(prefix)) { - return null; - } - Set keys = properties.keySet(); - if (keys.isEmpty()) { - return null; - } - Map propertiesMap = new HashMap<>(); - keys.forEach(k -> { - if (k.toString().contains(prefix)) { - propertiesMap.put(k.toString().replaceFirst(prefix + ".", ""), properties.getProperty((String) k)); - } - }); - return propertiesMap; - } - } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/StringUtils.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/StringUtils.java index 3d6bdfa738..4c116e817a 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/StringUtils.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/StringUtils.java @@ -30,8 +30,6 @@ public class StringUtils { */ public static final String EMPTY = ""; - public static final int INDEX_NOT_FOUND = -1; - private StringUtils() { throw new UnsupportedOperationException("Construct StringUtils"); } @@ -85,16 +83,6 @@ public class StringUtils { return !isBlank(cs); } - /** - *

Replace all strings matching the regular expression \t \n \r with _

- * - * @param src the String , may be null - * @return the string that has been replaced - */ - public static String replaceNRTtoUnderline(String src) { - return isBlank(src) ? src : src.replaceAll("[\n|\r|\t]", "_"); - } - /** *

Removes control characters (char <= 32) from both * ends of this String, handling {@code null} by returning @@ -134,46 +122,6 @@ public class StringUtils { return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2); } - public static String substringBefore(final String str, final String separator) { - if (isEmpty(str) || separator == null) { - return str; - } - if (separator.isEmpty()) { - return EMPTY; - } - final int pos = str.indexOf(separator); - if (pos == INDEX_NOT_FOUND) { - return str; - } - return str.substring(0, pos); - } - - public static String substringAfter(final String str, final String separator) { - if (isEmpty(str)) { - return str; - } - if (separator == null) { - return EMPTY; - } - final int pos = str.indexOf(separator); - if (pos == INDEX_NOT_FOUND) { - return EMPTY; - } - return str.substring(pos + separator.length()); - } - - public static long strDigitToLong(String str, long defaultValue) { - if (str == null) { - return defaultValue; - } else { - try { - return Long.parseLong(str); - } catch (NumberFormatException var4) { - return defaultValue; - } - } - } - /** *

Joins the elements of the provided Collection into a single String * containing the provided Collection of elements.

diff --git a/dolphinscheduler-standalone-server/pom.xml b/dolphinscheduler-standalone-server/pom.xml index e16c3d0825..4bb95265b4 100644 --- a/dolphinscheduler-standalone-server/pom.xml +++ b/dolphinscheduler-standalone-server/pom.xml @@ -47,7 +47,7 @@ org.apache.dolphinscheduler - dolphinscheduler-alert + dolphinscheduler-alert-server diff --git a/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java b/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java index f3ab194c86..2ace183691 100644 --- a/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java +++ b/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java @@ -17,105 +17,29 @@ package org.apache.dolphinscheduler.server; -import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME; -import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_PASSWORD; -import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_URL; -import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_USERNAME; - import org.apache.dolphinscheduler.alert.AlertServer; import org.apache.dolphinscheduler.api.ApiApplicationServer; -import org.apache.dolphinscheduler.common.utils.ScriptRunner; -import org.apache.dolphinscheduler.dao.datasource.ConnectionFactory; import org.apache.dolphinscheduler.server.master.MasterServer; import org.apache.dolphinscheduler.server.worker.WorkerServer; import org.apache.curator.test.TestingServer; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.SQLException; - -import javax.sql.DataSource; - -import org.h2.tools.Server; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.annotation.ComponentScan; -@SpringBootApplication +@EnableAutoConfiguration +@ComponentScan public class StandaloneServer { - private static final Logger LOGGER = LoggerFactory.getLogger(StandaloneServer.class); - public static void main(String[] args) throws Exception { - Thread.currentThread().setName("Standalone-Server"); - - System.setProperty("spring.profiles.active", "api"); - - startDatabase(); - - startRegistry(); - - startAlertServer(); - - setTaskPlugin(); - - new SpringApplicationBuilder( - ApiApplicationServer.class, - MasterServer.class, - WorkerServer.class - ).run(args); - } - - private static void startAlertServer() { - final Path alertPluginPath = Paths.get( - StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(), - "../../../dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml" - ).toAbsolutePath(); - if (Files.exists(alertPluginPath)) { - System.setProperty("alert.plugin.binding", alertPluginPath.toString()); - System.setProperty("alert.plugin.dir", ""); - } - AlertServer.getInstance().start(); - } - - private static void startRegistry() throws Exception { final TestingServer server = new TestingServer(true); System.setProperty("registry.servers", server.getConnectString()); - } - private static void startDatabase() throws IOException, SQLException { - final Path temp = Files.createTempDirectory("dolphinscheduler_"); - LOGGER.info("H2 database directory: {}", temp); - System.setProperty( - SPRING_DATASOURCE_DRIVER_CLASS_NAME, - org.h2.Driver.class.getName() - ); - System.setProperty( - SPRING_DATASOURCE_URL, - String.format("jdbc:h2:tcp://localhost/%s;MODE=MySQL;DATABASE_TO_LOWER=true", temp.toAbsolutePath()) - ); - System.setProperty(SPRING_DATASOURCE_USERNAME, "sa"); - System.setProperty(SPRING_DATASOURCE_PASSWORD, ""); - - Server.createTcpServer("-ifNotExists", "-tcpDaemon").start(); - - final DataSource ds = ConnectionFactory.getInstance().getDataSource(); - final ScriptRunner runner = new ScriptRunner(ds.getConnection(), true, true); - runner.runScript(new FileReader("sql/dolphinscheduler_h2.sql")); - } - - private static void setTaskPlugin() { - final Path taskPluginPath = Paths.get( - StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(), - "../../../dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml" - ).toAbsolutePath(); - if (Files.exists(taskPluginPath)) { - System.setProperty("task.plugin.binding", taskPluginPath.toString()); - System.setProperty("task.plugin.dir", ""); - } + new SpringApplicationBuilder( + ApiApplicationServer.class, + MasterServer.class, + WorkerServer.class, + AlertServer.class + ).profiles("master", "worker", "api", "alert", "h2", "standalone").run(args); } } diff --git a/dolphinscheduler-alert/src/main/resources/alert.properties b/dolphinscheduler-standalone-server/src/main/resources/application-h2.properties similarity index 51% rename from dolphinscheduler-alert/src/main/resources/alert.properties rename to dolphinscheduler-standalone-server/src/main/resources/application-h2.properties index c41ae61237..a9fd83fea0 100644 --- a/dolphinscheduler-alert/src/main/resources/alert.properties +++ b/dolphinscheduler-standalone-server/src/main/resources/application-h2.properties @@ -13,18 +13,4 @@ # 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. -# - -#This configuration file configures the configuration parameters related to the AlertServer. -#These parameters are only related to the AlertServer, and it has nothing to do with the specific Alert Plugin. -#eg : max retry num. -#eg : Alert Server Listener port - -#alert.plugin.dir config the Alert Plugin dir . AlertServer while find and load the Alert Plugin Jar from this dir when deploy and start AlertServer on the server . -#alert.plugin.dir=lib/plugin/alert - -#maven.local.repository=/Users/gaojun/Documents/jianguoyun/localRepository - -#alert.plugin.binding config the Alert Plugin need be load when development and run in IDE -#alert.plugin.binding=\ -# ./dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/pom.xml +# \ No newline at end of file diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml index d5b25a21e8..670eb812b8 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -281,7 +283,4 @@ - - dolphinscheduler-task-api-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/AbstractDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/AbstractDatasourceProcessor.java deleted file mode 100644 index 19d88e1588..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/AbstractDatasourceProcessor.java +++ /dev/null @@ -1,79 +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.dolphinscheduler.plugin.task.datasource; - -import org.apache.commons.collections.MapUtils; - -import java.util.Map; -import java.util.regex.Pattern; - -public abstract class AbstractDatasourceProcessor implements DatasourceProcessor { - - private static final Pattern IPV4_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$"); - - private static final Pattern IPV6_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\:\\[\\]]+$"); - - private static final Pattern DATABASE_PATTER = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.]+$"); - - private static final Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/]+$"); - - @Override - public void checkDatasourceParam(BaseDataSourceParamDTO baseDataSourceParamDTO) { - checkHost(baseDataSourceParamDTO.getHost()); - checkDatasourcePatter(baseDataSourceParamDTO.getDatabase()); - checkOther(baseDataSourceParamDTO.getOther()); - } - - /** - * Check the host is valid - * - * @param host datasource host - */ - protected void checkHost(String host) { - if (!IPV4_PATTERN.matcher(host).matches() || !IPV6_PATTERN.matcher(host).matches()) { - throw new IllegalArgumentException("datasource host illegal"); - } - } - - /** - * check database name is valid - * - * @param database database name - */ - protected void checkDatasourcePatter(String database) { - if (!DATABASE_PATTER.matcher(database).matches()) { - throw new IllegalArgumentException("datasource name illegal"); - } - } - - /** - * check other is valid - * - * @param other other - */ - protected void checkOther(Map other) { - if (MapUtils.isEmpty(other)) { - return; - } - boolean paramsCheck = other.entrySet().stream().allMatch(p -> PARAMS_PATTER.matcher(p.getValue()).matches()); - if (!paramsCheck) { - throw new IllegalArgumentException("datasource other params illegal"); - } - } - -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseConnectionParam.java deleted file mode 100644 index 44a5962f92..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseConnectionParam.java +++ /dev/null @@ -1,108 +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.dolphinscheduler.plugin.task.datasource; - -import org.apache.dolphinscheduler.plugin.task.datasource.clickhouse.ClickhouseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.db2.Db2ConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.hive.HiveConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.mysql.MysqlConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.oracle.OracleConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.postgresql.PostgreSqlConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.presto.PrestoConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.spark.SparkConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.sqlserver.SqlServerConnectionParam; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - * The base model of connection param - *

- * {@link ClickhouseConnectionParam} - * {@link Db2ConnectionParam} - * {@link HiveConnectionParam} - * {@link MysqlConnectionParam} - * {@link OracleConnectionParam} - * {@link PostgreSqlConnectionParam} - * {@link PrestoConnectionParam} - * {@link SparkConnectionParam} - * {@link SqlServerConnectionParam} - */ -@JsonInclude(Include.NON_NULL) -public abstract class BaseConnectionParam implements ConnectionParam { - - protected String user; - - protected String password; - - protected String address; - - protected String database; - - protected String jdbcUrl; - - protected String other; - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getDatabase() { - return database; - } - - public void setDatabase(String database) { - this.database = database; - } - - public String getJdbcUrl() { - return jdbcUrl; - } - - public void setJdbcUrl(String jdbcUrl) { - this.jdbcUrl = jdbcUrl; - } - - public String getOther() { - return other; - } - - public void setOther(String other) { - this.other = other; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseDataSourceParamDTO.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseDataSourceParamDTO.java deleted file mode 100644 index 5af330d38e..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseDataSourceParamDTO.java +++ /dev/null @@ -1,161 +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.dolphinscheduler.plugin.task.datasource; - -import org.apache.dolphinscheduler.plugin.task.datasource.clickhouse.ClickHouseDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.db2.Db2DatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.hive.HiveDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.mysql.MysqlDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.oracle.OracleDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.postgresql.PostgreSqlDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.presto.PrestoDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.spark.SparkDatasourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.sqlserver.SqlServerDatasourceParamDTO; -import org.apache.dolphinscheduler.spi.enums.DbType; - -import java.io.Serializable; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -/** - * Basic datasource params submitted to api. - *

- * see {@link MysqlDatasourceParamDTO} - * see {@link PostgreSqlDatasourceParamDTO} - * see {@link HiveDataSourceParamDTO} - * see {@link SparkDatasourceParamDTO} - * see {@link ClickHouseDatasourceParamDTO} - * see {@link OracleDatasourceParamDTO} - * see {@link SqlServerDatasourceParamDTO} - * see {@link Db2DatasourceParamDTO} - * see {@link PrestoDatasourceParamDTO} - */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") -@JsonSubTypes(value = { - @JsonSubTypes.Type(value = MysqlDatasourceParamDTO.class, name = "MYSQL"), - @JsonSubTypes.Type(value = PostgreSqlDatasourceParamDTO.class, name = "POSTGRESQL"), - @JsonSubTypes.Type(value = HiveDataSourceParamDTO.class, name = "HIVE"), - @JsonSubTypes.Type(value = SparkDatasourceParamDTO.class, name = "SPARK"), - @JsonSubTypes.Type(value = ClickHouseDatasourceParamDTO.class, name = "CLICKHOUSE"), - @JsonSubTypes.Type(value = OracleDatasourceParamDTO.class, name = "ORACLE"), - @JsonSubTypes.Type(value = SqlServerDatasourceParamDTO.class, name = "SQLSERVER"), - @JsonSubTypes.Type(value = Db2DatasourceParamDTO.class, name = "DB2"), - @JsonSubTypes.Type(value = PrestoDatasourceParamDTO.class, name = "PRESTO"), -}) -public abstract class BaseDataSourceParamDTO implements Serializable { - - protected Integer id; - - protected String name; - - protected String note; - - protected String host; - - protected Integer port; - - protected String database; - - protected String userName; - - protected String password; - - protected Map other; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNote() { - return note; - } - - public void setNote(String note) { - this.note = note; - } - - 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 getDatabase() { - return database; - } - - public void setDatabase(String database) { - this.database = database; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public Map getOther() { - return other; - } - - public void setOther(Map other) { - this.other = other; - } - - /** - * Get the datasource type - * see{@link DbType} - * - * @return datasource type code - */ - public abstract DbType getType(); -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsConnectionParam.java deleted file mode 100644 index ab24027487..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/BaseHdfsConnectionParam.java +++ /dev/null @@ -1,57 +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.dolphinscheduler.plugin.task.datasource; - -public class BaseHdfsConnectionParam extends BaseConnectionParam { - protected String principal; - protected String javaSecurityKrb5Conf; - protected String loginUserKeytabUsername; - protected String loginUserKeytabPath; - - public String getPrincipal() { - return principal; - } - - public void setPrincipal(String principal) { - this.principal = principal; - } - - public String getJavaSecurityKrb5Conf() { - return javaSecurityKrb5Conf; - } - - public void setJavaSecurityKrb5Conf(String javaSecurityKrb5Conf) { - this.javaSecurityKrb5Conf = javaSecurityKrb5Conf; - } - - public String getLoginUserKeytabUsername() { - return loginUserKeytabUsername; - } - - public void setLoginUserKeytabUsername(String loginUserKeytabUsername) { - this.loginUserKeytabUsername = loginUserKeytabUsername; - } - - public String getLoginUserKeytabPath() { - return loginUserKeytabPath; - } - - public void setLoginUserKeytabPath(String loginUserKeytabPath) { - this.loginUserKeytabPath = loginUserKeytabPath; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceUtil.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceUtil.java deleted file mode 100644 index d7b47f07ac..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/DatasourceUtil.java +++ /dev/null @@ -1,94 +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.dolphinscheduler.plugin.task.datasource; - -import org.apache.dolphinscheduler.plugin.task.datasource.clickhouse.ClickHouseDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.db2.Db2DatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.hive.HiveDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.mysql.MysqlDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.oracle.OracleDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.postgresql.PostgreSqlDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.presto.PrestoDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.spark.SparkDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.sqlserver.SqlServerDatasourceProcessor; -import org.apache.dolphinscheduler.spi.enums.DbType; - -import java.sql.Connection; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DatasourceUtil { - - private DatasourceUtil() { - } - - private static final Logger logger = LoggerFactory.getLogger(DatasourceUtil.class); - - private static final DatasourceProcessor mysqlProcessor = new MysqlDatasourceProcessor(); - private static final DatasourceProcessor postgreSqlProcessor = new PostgreSqlDatasourceProcessor(); - private static final DatasourceProcessor hiveProcessor = new HiveDatasourceProcessor(); - private static final DatasourceProcessor sparkProcessor = new SparkDatasourceProcessor(); - private static final DatasourceProcessor clickhouseProcessor = new ClickHouseDatasourceProcessor(); - private static final DatasourceProcessor oracleProcessor = new OracleDatasourceProcessor(); - private static final DatasourceProcessor sqlServerProcessor = new SqlServerDatasourceProcessor(); - private static final DatasourceProcessor db2PROCESSOR = new Db2DatasourceProcessor(); - private static final DatasourceProcessor prestoPROCESSOR = new PrestoDatasourceProcessor(); - - public static ConnectionParam buildConnectionParams(DbType dbType, String connectionJson) { - return getDatasourceProcessor(dbType).createConnectionParams(connectionJson); - } - - public static Connection getConnection(DbType dbType, ConnectionParam connectionParam) { - try { - return getDatasourceProcessor(dbType).getConnection(connectionParam); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static String getJdbcUrl(DbType dbType, ConnectionParam baseConnectionParam) { - return getDatasourceProcessor(dbType).getJdbcUrl(baseConnectionParam); - } - - public static DatasourceProcessor getDatasourceProcessor(DbType dbType) { - switch (dbType) { - case MYSQL: - return mysqlProcessor; - case POSTGRESQL: - return postgreSqlProcessor; - case HIVE: - return hiveProcessor; - case SPARK: - return sparkProcessor; - case CLICKHOUSE: - return clickhouseProcessor; - case ORACLE: - return oracleProcessor; - case SQLSERVER: - return sqlServerProcessor; - case DB2: - return db2PROCESSOR; - case PRESTO: - return prestoPROCESSOR; - default: - throw new IllegalArgumentException("datasource type illegal:" + dbType); - } - } - -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/HiveConfUtils.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/HiveConfUtils.java deleted file mode 100644 index 0985b7457c..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/HiveConfUtils.java +++ /dev/null @@ -1,87 +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.dolphinscheduler.plugin.task.datasource; - -import org.apache.hadoop.hive.conf.HiveConf; -import org.apache.hadoop.hive.conf.HiveConf.ConfVars; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * hive conf utils - */ -public class HiveConfUtils { - - private HiveConfUtils() { - throw new UnsupportedOperationException("Construct HiveConfUtils"); - } - - private static class HiveConfHandler { - private static HiveConf singleton; - - private static Map hiveConfVars; - - static { - singleton = new HiveConf(); - hiveConfVars = new HashMap<>(); - Arrays.stream(ConfVars.values()).forEach(confVar -> hiveConfVars.put(confVar.varname,confVar)); - } - } - - /** - * get HiveConf instance - * @return HiveConf hiveConf - */ - public static HiveConf getInstance() { - return HiveConfHandler.singleton; - } - - /** - * get hive conf vars - * @return - */ - public static Map getHiveConfVars() { - return HiveConfHandler.hiveConfVars; - } - - /** - * Determine if it belongs to a hive conf property - * @param conf config - * @return boolean result - */ - public static boolean isHiveConfVar(String conf) { - // the default hive conf var name - String confKey = conf.split("=")[0]; - Map hiveConfVars = HiveConfUtils.getHiveConfVars(); - if (hiveConfVars.get(confKey) != null) { - return true; - } - - // the security authorization hive conf var name - HiveConf hiveConf = HiveConfUtils.getInstance(); - String hiveAuthorizationSqlStdAuthConfigWhitelist = hiveConf.getVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_SQL_STD_AUTH_CONFIG_WHITELIST); - Pattern modWhiteListPattern = Pattern.compile(hiveAuthorizationSqlStdAuthConfigWhitelist); - Matcher matcher = modWhiteListPattern.matcher(confKey); - return matcher.matches(); - } - -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceProcessor.java deleted file mode 100644 index 624afee940..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickHouseDatasourceProcessor.java +++ /dev/null @@ -1,131 +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.dolphinscheduler.plugin.task.datasource.clickhouse; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_CLICKHOUSE_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_CLICKHOUSE; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; - -public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - ClickhouseConnectionParam connectionParams = (ClickhouseConnectionParam) createConnectionParams(connectionJson); - - ClickHouseDatasourceParamDTO clickHouseDatasourceParamDTO = new ClickHouseDatasourceParamDTO(); - clickHouseDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - clickHouseDatasourceParamDTO.setUserName(connectionParams.getUser()); - clickHouseDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - - String[] hostSeperator = connectionParams.getAddress().split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - clickHouseDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - clickHouseDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - - return clickHouseDatasourceParamDTO; - } - - @Override - public ConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - ClickHouseDatasourceParamDTO clickHouseParam = (ClickHouseDatasourceParamDTO) datasourceParam; - String address = String.format("%s%s:%s", JDBC_CLICKHOUSE, clickHouseParam.getHost(), clickHouseParam.getPort()); - String jdbcUrl = address + "/" + clickHouseParam.getDatabase(); - - ClickhouseConnectionParam clickhouseConnectionParam = new ClickhouseConnectionParam(); - clickhouseConnectionParam.setDatabase(clickHouseParam.getDatabase()); - clickhouseConnectionParam.setAddress(address); - clickhouseConnectionParam.setJdbcUrl(jdbcUrl); - clickhouseConnectionParam.setUser(clickHouseParam.getUserName()); - clickhouseConnectionParam.setPassword(encodePassword(clickHouseParam.getPassword())); - clickhouseConnectionParam.setOther(transformOther(clickHouseParam.getOther())); - return clickhouseConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, ClickhouseConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_CLICKHOUSE_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; - String jdbcUrl = clickhouseConnectionParam.getJdbcUrl(); - if (StringUtils.isNotEmpty(clickhouseConnectionParam.getOther())) { - jdbcUrl = String.format("%s?%s", jdbcUrl, clickhouseConnectionParam.getOther()); - } - return jdbcUrl; - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(clickhouseConnectionParam), - clickhouseConnectionParam.getUser(), decodePassword(clickhouseConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.CLICKHOUSE; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s%s", key, value, "&"))); - return stringBuilder.toString(); - } - - private Map parseOther(String other) { - if (other == null) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - String[] configs = other.split("&"); - for (String config : configs) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickhouseConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickhouseConnectionParam.java deleted file mode 100644 index c01d0005a9..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/clickhouse/ClickhouseConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.task.datasource.clickhouse; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; - -public class ClickhouseConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "ClickhouseConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2ConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2ConnectionParam.java deleted file mode 100644 index ba66c5e16e..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2ConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.task.datasource.db2; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; - -public class Db2ConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "Db2ConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceProcessor.java deleted file mode 100644 index ee130ebe60..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/db2/Db2DatasourceProcessor.java +++ /dev/null @@ -1,132 +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.dolphinscheduler.plugin.task.datasource.db2; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_DB2_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_DB2; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; - -public class Db2DatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - Db2ConnectionParam connectionParams = (Db2ConnectionParam) createConnectionParams(connectionJson); - - Db2DatasourceParamDTO db2DatasourceParamDTO = new Db2DatasourceParamDTO(); - db2DatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - db2DatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - db2DatasourceParamDTO.setUserName(db2DatasourceParamDTO.getUserName()); - - String[] hostSeperator = connectionParams.getAddress().split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - db2DatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - db2DatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - - return db2DatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - Db2DatasourceParamDTO db2Param = (Db2DatasourceParamDTO) datasourceParam; - String address = String.format("%s%s:%s", JDBC_DB2, db2Param.getHost(), db2Param.getPort()); - String jdbcUrl = String.format("%s/%s", address, db2Param.getDatabase()); - - Db2ConnectionParam db2ConnectionParam = new Db2ConnectionParam(); - db2ConnectionParam.setAddress(address); - db2ConnectionParam.setDatabase(db2Param.getDatabase()); - db2ConnectionParam.setJdbcUrl(jdbcUrl); - db2ConnectionParam.setUser(db2Param.getUserName()); - db2ConnectionParam.setPassword(encodePassword(db2Param.getPassword())); - db2ConnectionParam.setOther(transformOther(db2Param.getOther())); - - return db2ConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, Db2ConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_DB2_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - Db2ConnectionParam db2ConnectionParam = (Db2ConnectionParam) connectionParam; - if (StringUtils.isNotEmpty(db2ConnectionParam.getOther())) { - return String.format("%s;%s", db2ConnectionParam.getJdbcUrl(), db2ConnectionParam.getOther()); - } - return db2ConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - Db2ConnectionParam db2ConnectionParam = (Db2ConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(db2ConnectionParam), - db2ConnectionParam.getUser(), decodePassword(db2ConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.DB2; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s%s", key, value, ";"))); - stringBuilder.deleteCharAt(stringBuilder.length() - 1); - return stringBuilder.toString(); - } - - private Map parseOther(String other) { - if (other == null) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - for (String config : other.split("&")) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDatasourceProcessor.java deleted file mode 100644 index 16c4ceb111..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/hive/HiveDatasourceProcessor.java +++ /dev/null @@ -1,192 +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.dolphinscheduler.plugin.task.datasource.hive; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_HIVE_2; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.HiveConfUtils; -import org.apache.dolphinscheduler.plugin.task.util.CommonUtils; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; - -public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - HiveDataSourceParamDTO hiveDataSourceParamDTO = new HiveDataSourceParamDTO(); - HiveConnectionParam hiveConnectionParam = (HiveConnectionParam) createConnectionParams(connectionJson); - - hiveDataSourceParamDTO.setDatabase(hiveConnectionParam.getDatabase()); - hiveDataSourceParamDTO.setUserName(hiveConnectionParam.getUser()); - hiveDataSourceParamDTO.setOther(parseOther(hiveConnectionParam.getOther())); - hiveDataSourceParamDTO.setLoginUserKeytabUsername(hiveConnectionParam.getLoginUserKeytabUsername()); - hiveDataSourceParamDTO.setLoginUserKeytabPath(hiveConnectionParam.getLoginUserKeytabPath()); - hiveDataSourceParamDTO.setJavaSecurityKrb5Conf(hiveConnectionParam.getJavaSecurityKrb5Conf()); - - String[] tmpArray = hiveConnectionParam.getAddress().split(DOUBLE_SLASH); - StringBuilder hosts = new StringBuilder(); - String[] hostPortArray = tmpArray[tmpArray.length - 1].split(COMMA); - for (String hostPort : hostPortArray) { - hosts.append(hostPort.split(COLON)[0]).append(COMMA); - } - hosts.deleteCharAt(hosts.length() - 1); - hiveDataSourceParamDTO.setHost(hosts.toString()); - hiveDataSourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - - return hiveDataSourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - HiveDataSourceParamDTO hiveParam = (HiveDataSourceParamDTO) datasourceParam; - StringBuilder address = new StringBuilder(); - address.append(JDBC_HIVE_2); - for (String zkHost : hiveParam.getHost().split(",")) { - address.append(String.format("%s:%s,", zkHost, hiveParam.getPort())); - } - address.deleteCharAt(address.length() - 1); - String jdbcUrl = address.toString() + "/" + hiveParam.getDatabase(); - if (CommonUtils.getKerberosStartupState()) { - jdbcUrl += ";principal=" + hiveParam.getPrincipal(); - } - - HiveConnectionParam hiveConnectionParam = new HiveConnectionParam(); - hiveConnectionParam.setDatabase(hiveParam.getDatabase()); - hiveConnectionParam.setAddress(address.toString()); - hiveConnectionParam.setJdbcUrl(jdbcUrl); - hiveConnectionParam.setUser(hiveParam.getUserName()); - hiveConnectionParam.setPassword(encodePassword(hiveParam.getPassword())); - - if (CommonUtils.getKerberosStartupState()) { - hiveConnectionParam.setPrincipal(hiveParam.getPrincipal()); - hiveConnectionParam.setJavaSecurityKrb5Conf(hiveParam.getJavaSecurityKrb5Conf()); - hiveConnectionParam.setLoginUserKeytabPath(hiveParam.getLoginUserKeytabPath()); - hiveConnectionParam.setLoginUserKeytabUsername(hiveParam.getLoginUserKeytabUsername()); - } - hiveConnectionParam.setOther(transformOther(hiveParam.getOther())); - return hiveConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, HiveConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - HiveConnectionParam hiveConnectionParam = (HiveConnectionParam) connectionParam; - String jdbcUrl = hiveConnectionParam.getJdbcUrl(); - String otherParams = filterOther(hiveConnectionParam.getOther()); - if (StringUtils.isNotEmpty(otherParams) && !"?".equals(otherParams.substring(0, 1))) { - jdbcUrl += ";"; - } - return jdbcUrl + otherParams; - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws IOException, ClassNotFoundException, SQLException { - HiveConnectionParam hiveConnectionParam = (HiveConnectionParam) connectionParam; - CommonUtils.loadKerberosConf(hiveConnectionParam.getJavaSecurityKrb5Conf(), - hiveConnectionParam.getLoginUserKeytabUsername(), hiveConnectionParam.getLoginUserKeytabPath()); - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(connectionParam), - hiveConnectionParam.getUser(), decodePassword(hiveConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.HIVE; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s;", key, value))); - return stringBuilder.toString(); - } - - private String filterOther(String otherParams) { - if (StringUtils.isBlank(otherParams)) { - return ""; - } - - StringBuilder hiveConfListSb = new StringBuilder(); - hiveConfListSb.append("?"); - StringBuilder sessionVarListSb = new StringBuilder(); - - String[] otherArray = otherParams.split(";", -1); - - for (String conf : otherArray) { - if (HiveConfUtils.isHiveConfVar(conf)) { - hiveConfListSb.append(conf).append(";"); - } else { - sessionVarListSb.append(conf).append(";"); - } - } - - // remove the last ";" - if (sessionVarListSb.length() > 0) { - sessionVarListSb.deleteCharAt(sessionVarListSb.length() - 1); - } - - if (hiveConfListSb.length() > 0) { - hiveConfListSb.deleteCharAt(hiveConfListSb.length() - 1); - } - - return sessionVarListSb.toString() + hiveConfListSb.toString(); - } - - private Map parseOther(String other) { - if (other == null) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - String[] configs = other.split(";"); - for (String config : configs) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceProcessor.java deleted file mode 100644 index e41ccd21c5..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/mysql/MysqlDatasourceProcessor.java +++ /dev/null @@ -1,176 +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.dolphinscheduler.plugin.task.datasource.mysql; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_MYSQL_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_MYSQL; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor { - - private final Logger logger = LoggerFactory.getLogger(MysqlDatasourceProcessor.class); - - private static final String ALLOW_LOAD_LOCAL_IN_FILE_NAME = "allowLoadLocalInfile"; - - private static final String AUTO_DESERIALIZE = "autoDeserialize"; - - private static final String ALLOW_LOCAL_IN_FILE_NAME = "allowLocalInfile"; - - private static final String ALLOW_URL_IN_LOCAL_IN_FILE_NAME = "allowUrlInLocalInfile"; - - private static final String APPEND_PARAMS = "allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"; - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - MysqlConnectionParam connectionParams = (MysqlConnectionParam) createConnectionParams(connectionJson); - MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); - - mysqlDatasourceParamDTO.setUserName(connectionParams.getUser()); - mysqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - mysqlDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - - String address = connectionParams.getAddress(); - String[] hostSeperator = address.split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - mysqlDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - mysqlDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - - return mysqlDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) { - MysqlDatasourceParamDTO mysqlDatasourceParam = (MysqlDatasourceParamDTO) dataSourceParam; - String address = String.format("%s%s:%s", JDBC_MYSQL, mysqlDatasourceParam.getHost(), mysqlDatasourceParam.getPort()); - String jdbcUrl = String.format("%s/%s", address, mysqlDatasourceParam.getDatabase()); - - MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); - mysqlConnectionParam.setJdbcUrl(jdbcUrl); - mysqlConnectionParam.setDatabase(mysqlDatasourceParam.getDatabase()); - mysqlConnectionParam.setAddress(address); - mysqlConnectionParam.setUser(mysqlDatasourceParam.getUserName()); - mysqlConnectionParam.setPassword(encodePassword(mysqlDatasourceParam.getPassword())); - mysqlConnectionParam.setOther(transformOther(mysqlDatasourceParam.getOther())); - - return mysqlConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, MysqlConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_MYSQL_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - MysqlConnectionParam mysqlConnectionParam = (MysqlConnectionParam) connectionParam; - String jdbcUrl = mysqlConnectionParam.getJdbcUrl(); - if (StringUtils.isNotEmpty(mysqlConnectionParam.getOther())) { - return String.format("%s?%s&%s", jdbcUrl, mysqlConnectionParam.getOther(), APPEND_PARAMS); - } - return String.format("%s?%s", jdbcUrl, APPEND_PARAMS); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - MysqlConnectionParam mysqlConnectionParam = (MysqlConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - String user = mysqlConnectionParam.getUser(); - if (user.contains(AUTO_DESERIALIZE)) { - logger.warn("sensitive param : {} in username field is filtered", AUTO_DESERIALIZE); - user = user.replace(AUTO_DESERIALIZE, ""); - } - String password = decodePassword(mysqlConnectionParam.getPassword()); - if (password.contains(AUTO_DESERIALIZE)) { - logger.warn("sensitive param : {} in password field is filtered", AUTO_DESERIALIZE); - password = password.replace(AUTO_DESERIALIZE, ""); - } - return DriverManager.getConnection(getJdbcUrl(connectionParam), user, password); - } - - @Override - public DbType getDbType() { - return DbType.MYSQL; - } - - private String transformOther(Map paramMap) { - if (MapUtils.isEmpty(paramMap)) { - return null; - } - Map otherMap = new HashMap<>(); - paramMap.forEach((k, v) -> { - if (!checkKeyIsLegitimate(k)) { - return; - } - otherMap.put(k, v); - }); - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s&", key, value))); - return stringBuilder.toString(); - } - - private static boolean checkKeyIsLegitimate(String key) { - return !key.contains(ALLOW_LOAD_LOCAL_IN_FILE_NAME) - && !key.contains(AUTO_DESERIALIZE) - && !key.contains(ALLOW_LOCAL_IN_FILE_NAME) - && !key.contains(ALLOW_URL_IN_LOCAL_IN_FILE_NAME); - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - for (String config : other.split("&")) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } - -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceProcessor.java deleted file mode 100644 index bfe94960b0..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/oracle/OracleDatasourceProcessor.java +++ /dev/null @@ -1,149 +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.dolphinscheduler.plugin.task.datasource.oracle; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.AT_SIGN; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_ORACLE_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_ORACLE_SERVICE_NAME; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_ORACLE_SID; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbConnectType; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class OracleDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - OracleConnectionParam connectionParams = (OracleConnectionParam) createConnectionParams(connectionJson); - OracleDatasourceParamDTO oracleDatasourceParamDTO = new OracleDatasourceParamDTO(); - - oracleDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - oracleDatasourceParamDTO.setUserName(connectionParams.getUser()); - oracleDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - - String hostSeperator = DOUBLE_SLASH; - if (DbConnectType.ORACLE_SID.equals(connectionParams.connectType)) { - hostSeperator = AT_SIGN; - } - String[] hostPort = connectionParams.getAddress().split(hostSeperator); - String[] hostPortArray = hostPort[hostPort.length - 1].split(COMMA); - oracleDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - oracleDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - - return oracleDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - OracleDatasourceParamDTO oracleParam = (OracleDatasourceParamDTO) datasourceParam; - String address; - if (DbConnectType.ORACLE_SID.equals(oracleParam.getConnectType())) { - address = String.format("%s%s:%s", - JDBC_ORACLE_SID, oracleParam.getHost(), oracleParam.getPort()); - } else { - address = String.format("%s%s:%s", - JDBC_ORACLE_SERVICE_NAME, oracleParam.getHost(), oracleParam.getPort()); - } - String jdbcUrl = address + "/" + oracleParam.getDatabase(); - - OracleConnectionParam oracleConnectionParam = new OracleConnectionParam(); - oracleConnectionParam.setUser(oracleParam.getUserName()); - oracleConnectionParam.setPassword(encodePassword(oracleParam.getPassword())); - oracleConnectionParam.setAddress(address); - oracleConnectionParam.setJdbcUrl(jdbcUrl); - oracleConnectionParam.setDatabase(oracleParam.getDatabase()); - oracleConnectionParam.setConnectType(oracleParam.getConnectType()); - oracleConnectionParam.setOther(transformOther(oracleParam.getOther())); - - return oracleConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, OracleConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_ORACLE_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - OracleConnectionParam oracleConnectionParam = (OracleConnectionParam) connectionParam; - if (StringUtils.isNotEmpty(oracleConnectionParam.getOther())) { - return String.format("%s?%s", oracleConnectionParam.getJdbcUrl(), oracleConnectionParam.getOther()); - } - return oracleConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - OracleConnectionParam oracleConnectionParam = (OracleConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(connectionParam), - oracleConnectionParam.getUser(), decodePassword(oracleConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.ORACLE; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - List list = new ArrayList<>(); - otherMap.forEach((key, value) -> list.add(String.format("%s=%s", key, value))); - return String.join("&", list); - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - String[] configs = other.split("&"); - for (String config : configs) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlConnectionParam.java deleted file mode 100644 index 1d459ca2b0..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.task.datasource.postgresql; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; - -public class PostgreSqlConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "PostgreSqlConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceProcessor.java deleted file mode 100644 index fc705c6e41..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/postgresql/PostgreSqlDatasourceProcessor.java +++ /dev/null @@ -1,132 +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.dolphinscheduler.plugin.task.datasource.postgresql; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_POSTGRESQL; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.ORG_POSTGRESQL_DRIVER; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; - -public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - PostgreSqlConnectionParam connectionParams = (PostgreSqlConnectionParam) createConnectionParams(connectionJson); - PostgreSqlDatasourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSqlDatasourceParamDTO(); - postgreSqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - postgreSqlDatasourceParamDTO.setUserName(connectionParams.getUser()); - postgreSqlDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - - String address = connectionParams.getAddress(); - String[] hostSeperator = address.split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - postgreSqlDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - postgreSqlDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - - return postgreSqlDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - PostgreSqlDatasourceParamDTO postgreSqlParam = (PostgreSqlDatasourceParamDTO) datasourceParam; - String address = String.format("%s%s:%s", JDBC_POSTGRESQL, postgreSqlParam.getHost(), postgreSqlParam.getPort()); - String jdbcUrl = String.format("%s/%s", address, postgreSqlParam.getDatabase()); - - PostgreSqlConnectionParam postgreSqlConnectionParam = new PostgreSqlConnectionParam(); - postgreSqlConnectionParam.setJdbcUrl(jdbcUrl); - postgreSqlConnectionParam.setAddress(address); - postgreSqlConnectionParam.setDatabase(postgreSqlParam.getDatabase()); - postgreSqlConnectionParam.setUser(postgreSqlParam.getUserName()); - postgreSqlConnectionParam.setPassword(encodePassword(postgreSqlParam.getPassword())); - postgreSqlConnectionParam.setOther(transformOther(postgreSqlParam.getOther())); - - return postgreSqlConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, PostgreSqlConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return ORG_POSTGRESQL_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; - if (StringUtils.isNotEmpty(postgreSqlConnectionParam.getOther())) { - return String.format("%s?%s", postgreSqlConnectionParam.getJdbcUrl(), postgreSqlConnectionParam.getOther()); - } - return postgreSqlConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(postgreSqlConnectionParam), - postgreSqlConnectionParam.getUser(), decodePassword(postgreSqlConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.POSTGRESQL; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s&", key, value))); - return stringBuilder.toString(); - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - for (String config : other.split("&")) { - String[] split = config.split("="); - otherMap.put(split[0], split[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoConnectionParam.java deleted file mode 100644 index b6a226d982..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.task.datasource.presto; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; - -public class PrestoConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "PrestoConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceProcessor.java deleted file mode 100644 index d8630bf95f..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/presto/PrestoDatasourceProcessor.java +++ /dev/null @@ -1,134 +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.dolphinscheduler.plugin.task.datasource.presto; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_PRESTO_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_PRESTO; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - PrestoConnectionParam connectionParams = (PrestoConnectionParam) createConnectionParams(connectionJson); - - String[] hostSeperator = connectionParams.getAddress().split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - - PrestoDatasourceParamDTO prestoDatasourceParamDTO = new PrestoDatasourceParamDTO(); - prestoDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - prestoDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - prestoDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - prestoDatasourceParamDTO.setUserName(connectionParams.getUser()); - prestoDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - - return prestoDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - PrestoDatasourceParamDTO prestoParam = (PrestoDatasourceParamDTO) datasourceParam; - String address = String.format("%s%s:%s", JDBC_PRESTO, prestoParam.getHost(), prestoParam.getPort()); - String jdbcUrl = address + "/" + prestoParam.getDatabase(); - - PrestoConnectionParam prestoConnectionParam = new PrestoConnectionParam(); - prestoConnectionParam.setUser(prestoParam.getUserName()); - prestoConnectionParam.setPassword(encodePassword(prestoParam.getPassword())); - prestoConnectionParam.setOther(transformOther(prestoParam.getOther())); - prestoConnectionParam.setAddress(address); - prestoConnectionParam.setJdbcUrl(jdbcUrl); - prestoConnectionParam.setDatabase(prestoParam.getDatabase()); - - return prestoConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, PrestoConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_PRESTO_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - PrestoConnectionParam prestoConnectionParam = (PrestoConnectionParam) connectionParam; - if (StringUtils.isNotEmpty(prestoConnectionParam.getOther())) { - return String.format("%s?%s", prestoConnectionParam.getJdbcUrl(), prestoConnectionParam.getOther()); - } - return prestoConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - PrestoConnectionParam prestoConnectionParam = (PrestoConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(connectionParam), - prestoConnectionParam.getUser(), decodePassword(prestoConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.PRESTO; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isNotEmpty(otherMap)) { - List list = new ArrayList<>(); - otherMap.forEach((key, value) -> list.add(String.format("%s=%s", key, value))); - return String.join("&", list); - } - return null; - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - String[] configs = other.split("&"); - for (String config : configs) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkConnectionParam.java deleted file mode 100644 index fad385e3ce..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkConnectionParam.java +++ /dev/null @@ -1,38 +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.dolphinscheduler.plugin.task.datasource.spark; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseHdfsConnectionParam; - -public class SparkConnectionParam extends BaseHdfsConnectionParam { - @Override - public String toString() { - return "SparkConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + ", principal='" + principal + '\'' - + ", javaSecurityKrb5Conf='" + javaSecurityKrb5Conf + '\'' - + ", loginUserKeytabUsername='" + loginUserKeytabUsername + '\'' - + ", loginUserKeytabPath='" + loginUserKeytabPath + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceProcessor.java deleted file mode 100644 index 00e7ecbe0d..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/spark/SparkDatasourceProcessor.java +++ /dev/null @@ -1,161 +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.dolphinscheduler.plugin.task.datasource.spark; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_HIVE_2; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.plugin.task.util.CommonUtils; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class SparkDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - SparkConnectionParam connectionParams = (SparkConnectionParam) createConnectionParams(connectionJson); - - SparkDatasourceParamDTO sparkDatasourceParamDTO = new SparkDatasourceParamDTO(); - sparkDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - sparkDatasourceParamDTO.setUserName(connectionParams.getUser()); - sparkDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - sparkDatasourceParamDTO.setJavaSecurityKrb5Conf(connectionParams.getJavaSecurityKrb5Conf()); - sparkDatasourceParamDTO.setLoginUserKeytabPath(connectionParams.getLoginUserKeytabPath()); - sparkDatasourceParamDTO.setLoginUserKeytabUsername(connectionParams.getLoginUserKeytabUsername()); - - StringBuilder hosts = new StringBuilder(); - String[] tmpArray = connectionParams.getAddress().split(DOUBLE_SLASH); - String[] hostPortArray = tmpArray[tmpArray.length - 1].split(COMMA); - Arrays.stream(hostPortArray).forEach(hostPort -> hosts.append(hostPort.split(COLON)[0]).append(COMMA)); - hosts.deleteCharAt(hosts.length() - 1); - - sparkDatasourceParamDTO.setHost(hosts.toString()); - sparkDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - - return sparkDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) { - StringBuilder address = new StringBuilder(); - SparkDatasourceParamDTO sparkDatasourceParam = (SparkDatasourceParamDTO) dataSourceParam; - address.append(JDBC_HIVE_2); - for (String zkHost : sparkDatasourceParam.getHost().split(",")) { - address.append(String.format("%s:%s,", zkHost, sparkDatasourceParam.getPort())); - } - address.deleteCharAt(address.length() - 1); - - String jdbcUrl = address + "/" + sparkDatasourceParam.getDatabase(); - if (CommonUtils.getKerberosStartupState()) { - jdbcUrl += ";principal=" + sparkDatasourceParam.getPrincipal(); - } - - SparkConnectionParam sparkConnectionParam = new SparkConnectionParam(); - sparkConnectionParam.setPassword(encodePassword(sparkDatasourceParam.getPassword())); - sparkConnectionParam.setUser(sparkDatasourceParam.getUserName()); - sparkConnectionParam.setOther(transformOther(sparkDatasourceParam.getOther())); - sparkConnectionParam.setDatabase(sparkDatasourceParam.getDatabase()); - sparkConnectionParam.setAddress(address.toString()); - sparkConnectionParam.setJdbcUrl(jdbcUrl); - if (CommonUtils.getKerberosStartupState()) { - sparkConnectionParam.setPrincipal(sparkDatasourceParam.getPrincipal()); - sparkConnectionParam.setJavaSecurityKrb5Conf(sparkDatasourceParam.getJavaSecurityKrb5Conf()); - sparkConnectionParam.setLoginUserKeytabPath(sparkDatasourceParam.getLoginUserKeytabPath()); - sparkConnectionParam.setLoginUserKeytabUsername(sparkDatasourceParam.getLoginUserKeytabUsername()); - } - - return sparkConnectionParam; - } - - @Override - public ConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, SparkConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return ORG_APACHE_HIVE_JDBC_HIVE_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - SparkConnectionParam sparkConnectionParam = (SparkConnectionParam) connectionParam; - if (StringUtils.isNotEmpty(sparkConnectionParam.getOther())) { - return String.format("%s;%s", sparkConnectionParam.getJdbcUrl(), sparkConnectionParam.getOther()); - } - return sparkConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws IOException, ClassNotFoundException, SQLException { - SparkConnectionParam sparkConnectionParam = (SparkConnectionParam) connectionParam; - CommonUtils.loadKerberosConf(sparkConnectionParam.getJavaSecurityKrb5Conf(), - sparkConnectionParam.getLoginUserKeytabUsername(), sparkConnectionParam.getLoginUserKeytabPath()); - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(sparkConnectionParam), - sparkConnectionParam.getUser(), decodePassword(sparkConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.SPARK; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - List stringBuilder = otherMap.entrySet().stream() - .map(entry -> String.format("%s=%s", entry.getKey(), entry.getValue())).collect(Collectors.toList()); - return String.join(";", stringBuilder); - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - String[] configs = other.split(";"); - for (String config : configs) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerConnectionParam.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerConnectionParam.java deleted file mode 100644 index 5ef72fdeaa..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerConnectionParam.java +++ /dev/null @@ -1,34 +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.dolphinscheduler.plugin.task.datasource.sqlserver; - -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; - -public class SqlServerConnectionParam extends BaseConnectionParam { - @Override - public String toString() { - return "SqlServerConnectionParam{" - + "user='" + user + '\'' - + ", password='" + password + '\'' - + ", address='" + address + '\'' - + ", database='" + database + '\'' - + ", jdbcUrl='" + jdbcUrl + '\'' - + ", other='" + other + '\'' - + '}'; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceProcessor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceProcessor.java deleted file mode 100644 index 5eef2cd49d..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/datasource/sqlserver/SqlServerDatasourceProcessor.java +++ /dev/null @@ -1,129 +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.dolphinscheduler.plugin.task.datasource.sqlserver; - -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.encodePassword; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COLON; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COMMA; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.COM_SQLSERVER_JDBC_DRIVER; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_SLASH; -import static org.apache.dolphinscheduler.spi.task.TaskConstants.JDBC_SQLSERVER; - -import org.apache.dolphinscheduler.plugin.task.datasource.AbstractDatasourceProcessor; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseDataSourceParamDTO; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.spi.enums.DbType; -import org.apache.dolphinscheduler.spi.utils.JSONUtils; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.collections.MapUtils; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; - -public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor { - - @Override - public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { - SqlServerConnectionParam connectionParams = (SqlServerConnectionParam) createConnectionParams(connectionJson); - String[] hostSeperator = connectionParams.getAddress().split(DOUBLE_SLASH); - String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(COMMA); - - SqlServerDatasourceParamDTO sqlServerDatasourceParamDTO = new SqlServerDatasourceParamDTO(); - sqlServerDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); - sqlServerDatasourceParamDTO.setUserName(connectionParams.getUser()); - sqlServerDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); - sqlServerDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(COLON)[1])); - sqlServerDatasourceParamDTO.setHost(hostPortArray[0].split(COLON)[0]); - return sqlServerDatasourceParamDTO; - } - - @Override - public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { - SqlServerDatasourceParamDTO sqlServerParam = (SqlServerDatasourceParamDTO) datasourceParam; - String address = String.format("%s%s:%s", JDBC_SQLSERVER, sqlServerParam.getHost(), sqlServerParam.getPort()); - String jdbcUrl = address + ";databaseName=" + sqlServerParam.getDatabase(); - - SqlServerConnectionParam sqlServerConnectionParam = new SqlServerConnectionParam(); - sqlServerConnectionParam.setAddress(address); - sqlServerConnectionParam.setDatabase(sqlServerParam.getDatabase()); - sqlServerConnectionParam.setJdbcUrl(jdbcUrl); - sqlServerConnectionParam.setOther(transformOther(sqlServerParam.getOther())); - sqlServerConnectionParam.setUser(sqlServerParam.getUserName()); - sqlServerConnectionParam.setPassword(encodePassword(sqlServerParam.getPassword())); - return sqlServerConnectionParam; - } - - @Override - public BaseConnectionParam createConnectionParams(String connectionJson) { - return JSONUtils.parseObject(connectionJson, SqlServerConnectionParam.class); - } - - @Override - public String getDatasourceDriver() { - return COM_SQLSERVER_JDBC_DRIVER; - } - - @Override - public String getJdbcUrl(ConnectionParam connectionParam) { - SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; - - if (StringUtils.isNotEmpty(sqlServerConnectionParam.getOther())) { - return String.format("%s;%s", sqlServerConnectionParam.getJdbcUrl(), sqlServerConnectionParam.getOther()); - } - return sqlServerConnectionParam.getJdbcUrl(); - } - - @Override - public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { - SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; - Class.forName(getDatasourceDriver()); - return DriverManager.getConnection(getJdbcUrl(connectionParam), sqlServerConnectionParam.getUser(), - decodePassword(sqlServerConnectionParam.getPassword())); - } - - @Override - public DbType getDbType() { - return DbType.SQLSERVER; - } - - private String transformOther(Map otherMap) { - if (MapUtils.isEmpty(otherMap)) { - return null; - } - StringBuilder stringBuilder = new StringBuilder(); - otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s;", key, value))); - return stringBuilder.toString(); - } - - private Map parseOther(String other) { - if (StringUtils.isEmpty(other)) { - return null; - } - Map otherMap = new LinkedHashMap<>(); - for (String config : other.split(";")) { - otherMap.put(config.split("=")[0], config.split("=")[1]); - } - return otherMap; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/pom.xml index 1321f2fde2..d02a118f1d 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,9 +26,14 @@ 4.0.0 dolphinscheduler-task-datax - dolphinscheduler-plugin + jar + + org.apache.dolphinscheduler + dolphinscheduler-datasource-all + + org.apache.dolphinscheduler dolphinscheduler-spi @@ -37,6 +44,11 @@ dolphinscheduler-task-api ${project.version} + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + com.alibaba @@ -44,9 +56,4 @@ - - - dolphinscheduler-task-datax-${project.version} - - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java index 9087070df3..3fbabe5166 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java @@ -17,17 +17,18 @@ package org.apache.dolphinscheduler.plugin.task.datax; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; +import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword; import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_FAILURE; import static org.apache.dolphinscheduler.spi.task.TaskConstants.RWXR_XR_X; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskResponse; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.util.MapUtils; import org.apache.dolphinscheduler.plugin.task.util.OSUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.Flag; import org.apache.dolphinscheduler.spi.task.AbstractParameters; @@ -36,10 +37,10 @@ import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils; import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils; import org.apache.dolphinscheduler.spi.task.request.DataxTaskExecutionContext; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.io.FileUtils; import java.io.File; @@ -547,7 +548,7 @@ public class DataxTask extends AbstractTaskExecutor { sql = sql.replace(";", ""); try ( - Connection connection = DatasourceUtil.getConnection(sourceType, baseDataSource); + Connection connection = DataSourceClientProvider.getInstance().getConnection(sourceType, baseDataSource); PreparedStatement stmt = connection.prepareStatement(sql); ResultSet resultSet = stmt.executeQuery()) { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskChannelFactory.java index bb35b716c0..d9c16ef0b2 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class DataxTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml index 6e55c5ac06..f362486894 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,7 +26,7 @@ 4.0.0 dolphinscheduler-task-flink - dolphinscheduler-plugin + jar @@ -38,8 +40,4 @@ ${project.version} - - - dolphinscheduler-task-flink-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskChannelFactory.java index 6d843c637a..7501f16fe8 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class FlinkTaskChannelFactory implements TaskChannelFactory { @Override public TaskChannel create() { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskPlugin.java deleted file mode 100644 index 1b687fff91..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskPlugin.java +++ /dev/null @@ -1,30 +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.dolphinscheduler.plugin.task.flink; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class FlinkTaskPlugin implements DolphinSchedulerPlugin { - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new FlinkTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/pom.xml index 2daf812c00..5da1ddc8b1 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,7 +26,7 @@ 4.0.0 dolphinscheduler-task-http - dolphinscheduler-plugin + jar @@ -38,6 +40,10 @@ ${project.version} + + org.apache.commons + commons-collections4 + org.apache.httpcomponents httpclient @@ -48,9 +54,4 @@ - - - dolphinscheduler-task-http-${project.version} - - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java index 4f29a3117d..f57238dcc2 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java @@ -27,11 +27,11 @@ import org.apache.dolphinscheduler.spi.task.Property; import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils; import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.DateUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.Charsets; import org.apache.http.HttpEntity; import org.apache.http.ParseException; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskChannelFactory.java index 4791b26a16..e69524c9ba 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class HttpTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskPlugin.java deleted file mode 100644 index fa2a4705ca..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.http; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class HttpTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new HttpTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/pom.xml index f409aa3a92..cfcb066625 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,7 +26,7 @@ 4.0.0 dolphinscheduler-task-mr - dolphinscheduler-plugin + jar @@ -37,11 +39,5 @@ dolphinscheduler-task-api ${project.version} - - - - dolphinscheduler-task-mr-${project.version} - - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskChannelFactory.java index 165ee1a83e..6d1beadcbe 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class MapReduceTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskPlugin.java deleted file mode 100644 index 4e5657e1cb..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-mr/src/main/java/org/apache/dolphinscheduler/plugin/task/mr/MapReduceTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.mr; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class MapReduceTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new MapReduceTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/pom.xml index 291b69735f..5db3e1f6b5 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -25,7 +27,7 @@ 4.0.0 dolphinscheduler-task-pigeon - dolphinscheduler-plugin + jar @@ -38,6 +40,10 @@ dolphinscheduler-spi provided + + org.apache.commons + commons-collections4 + org.slf4j slf4j-api @@ -63,18 +69,6 @@ - - - - - - - org.jacoco - org.jacoco.agent - runtime - test - - org.java-websocket Java-WebSocket @@ -96,16 +90,5 @@ org.powermock powermock-api-mockito2 - - - junit - junit - test - - - - dolphinscheduler-task-pigeon-${project.version} - - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTask.java index 2ed7deef68..a17b9951e9 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTask.java @@ -21,10 +21,10 @@ import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.spi.task.AbstractParameters; import org.apache.dolphinscheduler.spi.task.TaskConstants; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.http.HttpEntity; import org.apache.http.StatusLine; import org.apache.http.client.methods.CloseableHttpResponse; @@ -178,7 +178,7 @@ public class PigeonTask extends AbstractTaskExecutor { if (!cancelResult.isSuccess()) { List errormsg = triggerResult.getErrormsg(); StringBuffer errs = new StringBuffer(); - if (org.apache.dolphinscheduler.spi.utils.CollectionUtils.isNotEmpty(errormsg)) { + if (CollectionUtils.isNotEmpty(errormsg)) { errs.append(",errs:").append(errormsg.stream().collect(Collectors.joining(","))); } throw new Exception("cancel PIGEON job faild taskId:" + triggerResult.getTaskId() + errs.toString()); diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskChannelFactory.java index bc0c6f2b9b..290acd6f77 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskChannelFactory.java @@ -26,6 +26,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.Arrays; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class PigeonTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskPlugin.java deleted file mode 100644 index b731d2ab24..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-pigeon/src/main/java/org/apache/dolphinscheduler/plugin/task/pigeon/PigeonTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.pigeon; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class PigeonTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new PigeonTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/pom.xml index 8295239463..5ae5ce5428 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,9 +26,14 @@ 4.0.0 dolphinscheduler-task-procedure - dolphinscheduler-plugin + jar + + org.apache.dolphinscheduler + dolphinscheduler-datasource-all + + org.apache.dolphinscheduler dolphinscheduler-spi @@ -37,10 +44,10 @@ dolphinscheduler-task-api ${project.version} + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + - - - dolphinscheduler-task-procedure-${project.version} - - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java index 397a1500a3..58d597fd54 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java @@ -21,9 +21,10 @@ import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_FAILU import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_SUCCESS; import static org.apache.dolphinscheduler.spi.task.TaskConstants.TASK_LOG_INFO_FORMAT; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; -import org.apache.dolphinscheduler.plugin.task.datasource.ConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.DatasourceUtil; +import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.enums.DataType; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.TaskTimeoutStrategy; @@ -33,10 +34,11 @@ import org.apache.dolphinscheduler.spi.task.Property; import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils; import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections4.CollectionUtils; + import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; @@ -103,7 +105,7 @@ public class ProcedureTask extends AbstractTaskExecutor { taskExecutionContext.getProcedureTaskExecutionContext().getConnectionParams()); // get jdbc connection - connection = DatasourceUtil.getConnection(dbType, connectionParam); + connection = DataSourceClientProvider.getInstance().getConnection(dbType, connectionParam); // combining local and global parameters Map paramsMap = ParamUtils.convert(taskExecutionContext,getParameters()); @@ -323,4 +325,4 @@ public class ProcedureTask extends AbstractTaskExecutor { stmt.registerOutParameter(index, sqlType, value); } } -} \ No newline at end of file +} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskChannelFactory.java index 2530feb37d..d313ddfc3f 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class ProcedureTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskPlugin.java deleted file mode 100644 index 160bccd236..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.procedure; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class ProcedureTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new ProcedureTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml index 3c043f04a0..728b6e5a1b 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,22 +26,16 @@ 4.0.0 dolphinscheduler-task-python - dolphinscheduler-plugin + jar - - org.apache.dolphinscheduler - dolphinscheduler-spi - provided - - - org.apache.dolphinscheduler - dolphinscheduler-task-api - ${project.version} - + + org.apache.dolphinscheduler + dolphinscheduler-spi + + + org.apache.dolphinscheduler + dolphinscheduler-task-api + - - - dolphinscheduler-task-python-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java deleted file mode 100644 index d40f61b829..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java +++ /dev/null @@ -1,205 +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.dolphinscheduler.plugin.task.python; - -import java.util.Arrays; -import org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor; -import org.apache.dolphinscheduler.spi.task.request.TaskRequest; -import org.apache.dolphinscheduler.spi.utils.StringUtils; - -import org.apache.commons.io.FileUtils; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.function.Consumer; -import java.util.regex.Pattern; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * python command executor - */ -public class PythonCommandExecutor extends AbstractCommandExecutor { - - /** - * logger - */ - private static final Logger logger = LoggerFactory.getLogger(PythonCommandExecutor.class); - - /** - * python - */ - public static final String PYTHON = "python"; - - private static final Pattern PYTHON_PATH_PATTERN = Pattern.compile("/bin/python[\\d.]*$"); - - /** - * constructor - * - * @param logHandler log handler - * @param taskRequest TaskRequest - * @param logger logger - */ - public PythonCommandExecutor(Consumer> logHandler, - TaskRequest taskRequest, - Logger logger) { - super(logHandler, taskRequest, logger); - } - - - /** - * build command file path - * - * @return command file path - */ - @Override - protected String buildCommandFilePath() { - return String.format("%s/py_%s.command", taskRequest.getExecutePath(), taskRequest.getTaskAppId()); - } - - /** - * create command file if not exists - * - * @param execCommand exec command - * @param commandFile command file - * @throws IOException io exception - */ - @Override - protected void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException { - logger.info("tenantCode :{}, task dir:{}", taskRequest.getTenantCode(), taskRequest.getExecutePath()); - - if (!Files.exists(Paths.get(commandFile))) { - logger.info("generate command file:{}", commandFile); - - StringBuilder sb = new StringBuilder(); - sb.append("#-*- encoding=utf8 -*-\n"); - - sb.append("\n\n"); - sb.append(execCommand); - logger.info(sb.toString()); - - // write data to file - FileUtils.writeStringToFile(new File(commandFile), - sb.toString(), - StandardCharsets.UTF_8); - } - } - - /** - * get the absolute path of the Python command - * note : - * common.properties - * PYTHON_HOME configured under common.properties is Python absolute path, not PYTHON_HOME itself - *

- * for example : - * your PYTHON_HOM is /opt/python3.7/ - * you must set PYTHON_HOME is /opt/python3.7/python under nder common.properties - * dolphinscheduler.env.path file. - * - * @param envPath env path - * @return python home - */ - private static String getPythonHome(String envPath) { - // BufferedReader br = null; - StringBuilder sb = new StringBuilder(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(envPath)));) { - String line; - while ((line = br.readLine()) != null) { - if (line.contains(PythonConstants.PYTHON_HOME)) { - sb.append(line); - break; - } - } - String result = sb.toString(); - if (StringUtils.isEmpty(result)) { - return null; - } - String[] arrs = result.split(PythonConstants.EQUAL_SIGN); - if (arrs.length == 2) { - return arrs[1]; - } - } catch (IOException e) { - logger.error("read file failure", e); - } - return null; - } - - /** - * Gets the command path to which Python can execute - * @return python command path - */ - @Override - protected String commandInterpreter() { - String pythonHome = getPythonHome(taskRequest.getEnvFile()); - - if (StringUtils.isNotBlank(taskRequest.getEnvironmentConfig())) { - pythonHome = getPythonHomeFromEnvironmentConfig(taskRequest.getEnvironmentConfig()); - } - - return getPythonCommand(pythonHome); - } - - /** - * get python command - * - * @param pythonHome python home - * @return python command - */ - public static String getPythonCommand(String pythonHome) { - if (StringUtils.isEmpty(pythonHome)) { - return PYTHON; - } - File file = new File(pythonHome); - if (file.exists() && file.isFile()) { - return pythonHome; - } - if (PYTHON_PATH_PATTERN.matcher(pythonHome).find()) { - return pythonHome; - } - return Paths.get(pythonHome, "/bin/python").toString(); - } - - /** - * get python home from the environment config - * - * @param environmentConfig env config - * @return python home - */ - public static String getPythonHomeFromEnvironmentConfig(String environmentConfig) { - String[] lines = environmentConfig.split("\n"); - - String pythonHomeConfig = Arrays.stream(lines).filter(line -> line.contains(PythonConstants.PYTHON_HOME)).findFirst().get(); - - if (StringUtils.isEmpty(pythonHomeConfig)) { - return null; - } - String[] arrs = pythonHomeConfig.split(PythonConstants.EQUAL_SIGN); - if (arrs.length == 2) { - return arrs[1]; - } - return null; - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java index 01457da642..382f1778b9 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java @@ -18,6 +18,7 @@ package org.apache.dolphinscheduler.plugin.task.python; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; +import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskException; import org.apache.dolphinscheduler.plugin.task.api.TaskResponse; import org.apache.dolphinscheduler.plugin.task.util.MapUtils; @@ -29,6 +30,13 @@ import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.utils.JSONUtils; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; @@ -43,14 +51,9 @@ public class PythonTask extends AbstractTaskExecutor { private PythonParameters pythonParameters; /** - * task dir - */ - private String taskDir; - - /** - * python command executor + * shell command executor */ - private PythonCommandExecutor pythonCommandExecutor; + private ShellCommandExecutor shellCommandExecutor; private TaskRequest taskRequest; @@ -63,7 +66,7 @@ public class PythonTask extends AbstractTaskExecutor { super(taskRequest); this.taskRequest = taskRequest; - this.pythonCommandExecutor = new PythonCommandExecutor(this::logHandle, + this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, taskRequest, logger); } @@ -93,13 +96,20 @@ public class PythonTask extends AbstractTaskExecutor { @Override public void handle() throws Exception { try { - // construct process - String command = buildCommand(); - TaskResponse taskResponse = pythonCommandExecutor.run(command); + // generate the content of this python script + String pythonScriptContent = buildPythonScriptContent(); + // generate the file path of this python script + String pythonScriptFile = buildPythonCommandFilePath(); + + // create this file + createPythonCommandFileIfNotExists(pythonScriptContent,pythonScriptFile); + String command = "python " + pythonScriptFile; + + TaskResponse taskResponse = shellCommandExecutor.run(command); setExitStatusCode(taskResponse.getExitStatusCode()); setAppIds(taskResponse.getAppIds()); setProcessId(taskResponse.getProcessId()); - setVarPool(pythonCommandExecutor.getVarPool()); + setVarPool(shellCommandExecutor.getVarPool()); } catch (Exception e) { logger.error("python task failure", e); setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); @@ -110,7 +120,7 @@ public class PythonTask extends AbstractTaskExecutor { @Override public void cancelApplication(boolean cancelApplication) throws Exception { // cancel process - pythonCommandExecutor.cancelApplication(); + shellCommandExecutor.cancelApplication(); } @Override @@ -151,12 +161,48 @@ public class PythonTask extends AbstractTaskExecutor { } /** - * build command + * create python command file if not exists + * + * @param pythonScript exec python script + * @param pythonScriptFile python script file + * @throws IOException io exception + */ + protected void createPythonCommandFileIfNotExists(String pythonScript, String pythonScriptFile) throws IOException { + logger.info("tenantCode :{}, task dir:{}", taskRequest.getTenantCode(), taskRequest.getExecutePath()); + + if (!Files.exists(Paths.get(pythonScriptFile))) { + logger.info("generate python script file:{}", pythonScriptFile); + + StringBuilder sb = new StringBuilder(); + sb.append("#-*- encoding=utf8 -*-\n"); + + sb.append("\n\n"); + sb.append(pythonScript); + logger.info(sb.toString()); + + // write data to file + FileUtils.writeStringToFile(new File(pythonScriptFile), + sb.toString(), + StandardCharsets.UTF_8); + } + } + + /** + * build python command file path + * + * @return python command file path + */ + protected String buildPythonCommandFilePath() { + return String.format("%s/py_%s.py", taskRequest.getExecutePath(), taskRequest.getTaskAppId()); + } + + /** + * build python script content * * @return raw python script * @throws Exception exception */ - private String buildCommand() throws Exception { + private String buildPythonScriptContent() throws Exception { String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n"); // replace placeholder @@ -170,7 +216,6 @@ public class PythonTask extends AbstractTaskExecutor { rawPythonScript = ParameterUtils.convertParameterPlaceholders(rawPythonScript, ParamUtils.convert(paramsMap)); logger.info("raw python script : {}", pythonParameters.getRawScript()); - logger.info("task dir : {}", taskDir); return rawPythonScript; } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskChannelFactory.java index c41938b38c..55514e48f6 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskChannelFactory.java @@ -21,6 +21,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class PythonTaskChannelFactory implements TaskChannelFactory { @Override public TaskChannel create() { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskPlugin.java deleted file mode 100644 index 63fe7b792e..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.python; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class PythonTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new PythonTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml index e6f5fd4744..ef7829068e 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,7 +26,7 @@ 4.0.0 dolphinscheduler-task-shell - dolphinscheduler-plugin + jar @@ -43,8 +45,4 @@ commons-collections4 - - - dolphinscheduler-task-shell-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java index da294c511f..521e59bcce 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java @@ -28,6 +28,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.ArrayList; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class ShellTaskChannelFactory implements TaskChannelFactory { @Override public TaskChannel create() { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskPlugin.java deleted file mode 100644 index 512c5cffe1..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.shell; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class ShellTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new ShellTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml index 46b1ca111e..3a7cf48f2c 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -23,7 +25,7 @@ 4.0.0 dolphinscheduler-task-spark - dolphinscheduler-plugin + jar @@ -37,8 +39,4 @@ ${project.version} - - - dolphinscheduler-task-spark-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskChannelFactory.java index 29be5773ea..a468a9274f 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class SparkTaskChannelFactory implements TaskChannelFactory { @Override public String getName() { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskPlugin.java deleted file mode 100644 index ed35d3d5b5..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.spark; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class SparkTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new SparkTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/pom.xml index 4074c40592..6c690c67cd 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,9 +26,14 @@ 4.0.0 dolphinscheduler-task-sql - dolphinscheduler-plugin + jar + + org.apache.dolphinscheduler + dolphinscheduler-datasource-all + + org.apache.dolphinscheduler dolphinscheduler-spi @@ -37,6 +44,11 @@ dolphinscheduler-task-api ${project.version} + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + com.fasterxml.jackson.core @@ -45,8 +57,4 @@ - - - dolphinscheduler-task-sql-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlParameters.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlParameters.java index 487c5bd481..40d6d9cbd3 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlParameters.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlParameters.java @@ -21,10 +21,11 @@ import org.apache.dolphinscheduler.spi.enums.DataType; import org.apache.dolphinscheduler.spi.task.AbstractParameters; import org.apache.dolphinscheduler.spi.task.Property; import org.apache.dolphinscheduler.spi.task.ResourceInfo; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections.CollectionUtils; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java index 387b8be5f4..1b3a32c679 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java @@ -17,12 +17,13 @@ package org.apache.dolphinscheduler.plugin.task.sql; +import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskException; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.DatasourceUtil; -import org.apache.dolphinscheduler.plugin.task.util.CommonUtils; import org.apache.dolphinscheduler.plugin.task.util.MapUtils; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.spi.task.AbstractParameters; @@ -35,10 +36,11 @@ import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils; import org.apache.dolphinscheduler.spi.task.request.SQLTaskExecutionContext; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.task.request.UdfFuncRequest; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; +import org.apache.commons.collections.CollectionUtils; + import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -87,7 +89,7 @@ public class SqlTask extends AbstractTaskExecutor { /** * default query sql limit */ - private static final int LIMIT = 10000; + private static final int QUERY_LIMIT = 10000; /** * Abstract Yarn Task @@ -181,7 +183,7 @@ public class SqlTask extends AbstractTaskExecutor { try { // create connection - connection = DatasourceUtil.getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam); + connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam); // create temp function if (CollectionUtils.isNotEmpty(createFuncs)) { createTempFunction(connection, createFuncs); @@ -242,7 +244,7 @@ public class SqlTask extends AbstractTaskExecutor { int num = md.getColumnCount(); int rowCount = 0; - int limit = sqlParameters.getLimit() == 0 ? LIMIT : sqlParameters.getLimit(); + int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit(); while (rowCount < limit && resultSet.next()) { ObjectNode mapOfColValues = JSONUtils.createObjectNode(); @@ -252,7 +254,6 @@ public class SqlTask extends AbstractTaskExecutor { resultJSONArray.add(mapOfColValues); rowCount++; } - int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS; displayRows = Math.min(displayRows, resultJSONArray.size()); logger.info("display sql result {} rows as follows:", displayRows); @@ -260,6 +261,11 @@ public class SqlTask extends AbstractTaskExecutor { String row = JSONUtils.toJsonString(resultJSONArray.get(i)); logger.info("row {} : {}", i + 1, row); } + if (resultSet.next()) { + logger.info("sql result limit : {} exceeding results are filtered", limit); + String log = String.format("sql result limit : %d exceeding results are filtered", limit); + resultJSONArray.add(JSONUtils.toJsonNode(log)); + } } String result = JSONUtils.toJsonString(resultJSONArray); if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskChannelFactory.java index 47091ebb70..7259671954 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class SqlTaskChannelFactory implements TaskChannelFactory { @Override public String getName() { diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskPlugin.java deleted file mode 100644 index 65a3977bba..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.sql; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class SqlTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new SqlTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/pom.xml index f1bafbda20..cf00d61243 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler-task-plugin org.apache.dolphinscheduler @@ -24,7 +26,7 @@ 4.0.0 dolphinscheduler-task-sqoop - dolphinscheduler-plugin + jar @@ -32,15 +34,20 @@ dolphinscheduler-spi provided + + + org.apache.commons + commons-collections4 + org.apache.dolphinscheduler dolphinscheduler-task-api ${project.version} - + + org.apache.dolphinscheduler + dolphinscheduler-datasource-api + ${project.version} + - - - dolphinscheduler-task-sqoop-${project.version} - diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskChannelFactory.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskChannelFactory.java index c89ed00020..462c0397f0 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskChannelFactory.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskChannelFactory.java @@ -23,6 +23,9 @@ import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; import java.util.List; +import com.google.auto.service.AutoService; + +@AutoService(TaskChannelFactory.class) public class SqoopTaskChannelFactory implements TaskChannelFactory { @Override diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskPlugin.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskPlugin.java deleted file mode 100644 index e300ee50ee..0000000000 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTaskPlugin.java +++ /dev/null @@ -1,31 +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.dolphinscheduler.plugin.task.sqoop; - -import org.apache.dolphinscheduler.spi.DolphinSchedulerPlugin; -import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; - -import com.google.common.collect.ImmutableList; - -public class SqoopTaskPlugin implements DolphinSchedulerPlugin { - - @Override - public Iterable getTaskChannelFactorys() { - return ImmutableList.of(new SqoopTaskChannelFactory()); - } -} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/CommonGenerator.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/CommonGenerator.java index 36a99a56b8..0635296433 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/CommonGenerator.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/CommonGenerator.java @@ -24,7 +24,8 @@ import static org.apache.dolphinscheduler.spi.task.TaskConstants.SPACE; import org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.SqoopParameters; import org.apache.dolphinscheduler.spi.task.Property; -import org.apache.dolphinscheduler.spi.utils.CollectionUtils; + +import org.apache.commons.collections4.CollectionUtils; import java.util.List; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MysqlSourceGenerator.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MysqlSourceGenerator.java index b1ee6a9c4c..998ebcae50 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MysqlSourceGenerator.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MysqlSourceGenerator.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; +import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.COLUMNS; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.DB_CONNECT; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.DB_PWD; @@ -34,12 +34,12 @@ import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_QUOTES; import static org.apache.dolphinscheduler.spi.task.TaskConstants.EQUAL_SIGN; import static org.apache.dolphinscheduler.spi.task.TaskConstants.SPACE; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.sqoop.SqoopQueryType; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.ISourceGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.SqoopParameters; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.sources.SourceMysqlParameter; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.task.Property; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MysqlTargetGenerator.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MysqlTargetGenerator.java index 8c3450262a..642fe11056 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MysqlTargetGenerator.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MysqlTargetGenerator.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets; -import static org.apache.dolphinscheduler.plugin.task.datasource.PasswordUtils.decodePassword; +import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.COLUMNS; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.DB_CONNECT; import static org.apache.dolphinscheduler.plugin.task.sqoop.SqoopConstants.DB_PWD; @@ -31,11 +31,11 @@ import static org.apache.dolphinscheduler.spi.task.TaskConstants.DOUBLE_QUOTES; import static org.apache.dolphinscheduler.spi.task.TaskConstants.SINGLE_QUOTES; import static org.apache.dolphinscheduler.spi.task.TaskConstants.SPACE; -import org.apache.dolphinscheduler.plugin.task.datasource.BaseConnectionParam; -import org.apache.dolphinscheduler.plugin.task.datasource.DatasourceUtil; +import org.apache.dolphinscheduler.plugin.datasource.api.utils.DatasourceUtil; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.ITargetGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.SqoopParameters; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.targets.TargetMysqlParameter; +import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.utils.JSONUtils; diff --git a/dolphinscheduler-task-plugin/pom.xml b/dolphinscheduler-task-plugin/pom.xml index d2191933fb..3ffc5a6a4d 100644 --- a/dolphinscheduler-task-plugin/pom.xml +++ b/dolphinscheduler-task-plugin/pom.xml @@ -15,7 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + dolphinscheduler org.apache.dolphinscheduler @@ -40,6 +42,4 @@ dolphinscheduler-task-procedure dolphinscheduler-task-pigeon - - diff --git a/install.sh b/install.sh index c25d852b7b..5574df53c4 100755 --- a/install.sh +++ b/install.sh @@ -70,9 +70,6 @@ sed -i ${txt} "s@^#*worker.tenant.auto.create=.*@worker.tenant.auto.create=${wor sed -i ${txt} "s@^#*alert.listen.host=.*@alert.listen.host=${alertServer}@g" conf/worker.properties sed -i ${txt} "s@^#*task.plugin.dir=.*@task.plugin.dir=${installPath}/${taskPluginDir}@g" conf/worker.properties -# Change configuration in conf/alert.properties -sed -i ${txt} "s@^#*alert.plugin.dir=.*@alert.plugin.dir=${installPath}/${alertPluginDir}@g" conf/alert.properties - # Change configuration in conf/application-api.properties sed -i ${txt} "s@^#*server.port=.*@server.port=${apiServerPort}@g" conf/application-api.properties diff --git a/pom.xml b/pom.xml index ad231e0946..f51ebd4e8c 100644 --- a/pom.xml +++ b/pom.xml @@ -16,14 +16,14 @@ ~ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.dolphinscheduler dolphinscheduler 2.0.1-SNAPSHOT pom ${project.artifactId} - http://dolphinscheduler.apache.org + https://dolphinscheduler.apache.org Dolphin Scheduler is a distributed and easy-to-expand visual DAG workflow scheduling system, dedicated to solving the complex dependencies in data processing, making the scheduling system out of the box for data processing. @@ -60,8 +60,8 @@ UTF-8 4.3.0 3.4.14 - 5.1.19.RELEASE - 2.1.18.RELEASE + 5.3.12 + 2.5.6 1.8 1.2.3 2.7.3 @@ -69,7 +69,7 @@ 2.10.5 3.2.0 2.0.1 - 5.0.5 + 9.1.3 1.2.4 1.4.200 1.11 @@ -121,18 +121,40 @@ 2.9.2 1.5.24 2.0.0 - 0.184 - ${dep.airlift.version} 1.7.2 0.9.12 1.9.16 1.5.1 0.10.9 1.0.1 + false + 4.1.53.Final + 3.2.0 + + io.netty + netty-bom + ${netty.version} + import + pom + + + org.springframework.boot + spring-boot-starter-parent + ${spring.boot.version} + pom + import + + + + io.netty + netty-all + ${netty.version} + + org.java-websocket Java-WebSocket @@ -171,14 +193,6 @@ ${druid.version} - - org.springframework.boot - spring-boot-starter-parent - ${spring.boot.version} - pom - import - - org.springframework spring-core @@ -232,7 +246,87 @@ org.apache.dolphinscheduler - dolphinscheduler-registry + dolphinscheduler-registry-plugin + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-dao + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-api + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-remote + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-service + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-spi + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-python + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-api + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-server + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-dingtalk + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-email + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-feishu + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-http + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-script + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-slack + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-alert-wechat + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-registry-api ${project.version} @@ -240,40 +334,116 @@ dolphinscheduler-registry-zookeeper ${project.version} + org.apache.dolphinscheduler - dolphinscheduler-dao + dolphinscheduler-datasource-plugin ${project.version} org.apache.dolphinscheduler - dolphinscheduler-api + dolphinscheduler-datasource-all ${project.version} org.apache.dolphinscheduler - dolphinscheduler-remote + dolphinscheduler-datasource-api ${project.version} org.apache.dolphinscheduler - dolphinscheduler-service + dolphinscheduler-datasource-clickhouse ${project.version} org.apache.dolphinscheduler - dolphinscheduler-alert + dolphinscheduler-datasource-db2 ${project.version} org.apache.dolphinscheduler - dolphinscheduler-spi + dolphinscheduler-datasource-hive + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-mysql + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-oracle + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-postgresql + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-datasource-sqlserver ${project.version} org.apache.dolphinscheduler - dolphinscheduler-registry-api + dolphinscheduler-task-api + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-datax + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-flink + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-http + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-mr + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-pigeon + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-procedure + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-python + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-shell + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-spark + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-sql + ${project.version} + + + org.apache.dolphinscheduler + dolphinscheduler-task-sqoop ${project.version} @@ -373,13 +543,11 @@ - io.protostuff protostuff-core ${protostuff.version} - io.protostuff protostuff-runtime @@ -407,7 +575,6 @@ org.mockito mockito-core ${mockito.version} - jar test @@ -415,7 +582,6 @@ org.powermock powermock-module-junit4 ${powermock.version} - jar test @@ -423,21 +589,6 @@ org.powermock powermock-api-mockito2 ${powermock.version} - jar - test - - - org.mockito - mockito-core - - - - - - org.jacoco - org.jacoco.agent - ${jacoco.version} - runtime test @@ -504,7 +655,6 @@ ${logback.version} - org.apache.commons commons-email @@ -537,6 +687,10 @@ com.sun.jersey jersey-json + + junit + junit + @@ -614,13 +768,6 @@ ${presto.jdbc.version} - - net.jcip - jcip-annotations - ${jcip.version} - true - - javax.servlet servlet-api @@ -662,18 +809,6 @@ ${guava-retry.version} - - org.sonatype.aether - aether-api - 1.13.1 - - - - io.airlift.resolver - resolver - 1.5 - - org.ow2.asm asm @@ -691,26 +826,18 @@ javax.mail 1.6.2 + - com.google.auto.service - auto-service - ${auto-service.version} - true + net.sf.py4j + py4j + ${py4j.version} - apache-dolphinscheduler-${project.version} - - org.apache.dolphinscheduler - dolphinscheduler-maven-plugin - 1.0.0 - true - - ca.vanzyl.maven.plugins provisio-maven-plugin @@ -777,24 +904,16 @@ org.apache.maven.plugins maven-dependency-plugin ${maven-dependency-plugin.version} - + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} - - - org.apache.dolphinscheduler - dolphinscheduler-maven-plugin - true - - - - - - - ca.vanzyl.maven.plugins provisio-maven-plugin @@ -872,267 +991,6 @@ ${project.build.directory}/jacoco.exec - - - **/plugin/registry/zookeeper/ZookeeperRegistryTest.java - - **/api/controller/ProjectControllerTest.java - **/api/controller/QueueControllerTest.java - **/api/configuration/TrafficConfigurationTest.java - **/api/controller/ProcessDefinitionControllerTest.java - **/api/controller/TenantControllerTest.java - **/api/controller/SchedulerControllerTest.java - **/api/dto/resources/filter/ResourceFilterTest.java - **/api/dto/resources/visitor/ResourceTreeVisitorTest.java - **/api/enums/testGetEnum.java - **/api/enums/StatusTest.java - **/api/exceptions/ApiExceptionHandlerTest.java - **/api/exceptions/ServiceExceptionTest.java - **/api/interceptor/LocaleChangeInterceptorTest.java - **/api/interceptor/LoginHandlerInterceptorTest.java - **/api/interceptor/RateLimitInterceptorTest.java - **/api/security/impl/pwd/PasswordAuthenticatorTest.java - **/api/security/impl/ldap/LdapAuthenticatorTest.java - **/api/security/SecurityConfigLDAPTest.java - **/api/security/SecurityConfigPasswordTest.java - **/api/service/AccessTokenServiceTest.java - **/api/service/AlertGroupServiceTest.java - **/api/service/BaseDAGServiceTest.java - **/api/service/BaseServiceTest.java - **/api/service/DataAnalysisServiceTest.java - **/api/service/AlertPluginInstanceServiceTest.java - **/api/service/DataSourceServiceTest.java - **/api/service/ExecutorService2Test.java - **/api/service/ExecutorServiceTest.java - **/api/service/LoggerServiceTest.java - **/api/service/MonitorServiceTest.java - **/api/service/ProcessDefinitionServiceTest.java - **/api/service/ProcessTaskRelationServiceImplTest.java - **/api/service/TaskDefinitionServiceImplTest.java - **/api/service/ProcessInstanceServiceTest.java - **/api/service/ProjectServiceTest.java - **/api/service/QueueServiceTest.java - **/api/service/ResourcesServiceTest.java - **/api/service/SchedulerServiceTest.java - **/api/service/SessionServiceTest.java - **/api/service/TaskInstanceServiceTest.java - **/api/service/TenantServiceTest.java - **/api/service/UdfFuncServiceTest.java - **/api/service/UiPluginServiceTest.java - **/api/service/UserAlertGroupServiceTest.java - **/api/service/UsersServiceTest.java - **/api/service/WorkerGroupServiceTest.java - **/api/service/WorkFlowLineageServiceTest.java - **/api/service/EnvironmentServiceTest.java - **/api/service/EnvironmentWorkerGroupRelationServiceTest.java - **/api/controller/ProcessDefinitionControllerTest.java - **/api/controller/TaskInstanceControllerTest.java - **/api/controller/WorkFlowLineageControllerTest.java - **/api/controller/EnvironmentControllerTest.java - **/api/utils/exportprocess/DataSourceParamTest.java - **/api/utils/exportprocess/DependentParamTest.java - **/api/utils/CheckUtilsTest.java - **/api/utils/FileUtilsTest.java - **/api/utils/CheckUtilsTest.java - **/api/utils/CheckUtilsTest.java - **/api/utils/ResultTest.java - **/common/graph/DAGTest.java - **/common/os/OshiTest.java - **/common/shell/ShellExecutorTest.java - **/common/task/DataxParametersTest.java - **/common/task/EntityTestUtils.java - **/common/task/FlinkParametersTest.java - **/common/task/HttpParametersTest.java - **/common/task/SparkParametersTest.java - **/common/task/SqlParametersTest.java - **/common/task/SqoopParameterEntityTest.java - **/common/threadutils/ThreadPoolExecutorsTest.java - **/common/threadutils/ThreadUtilsTest.java - **/common/utils/CollectionUtilsTest.java - **/common/utils/CommonUtilsTest.java - **/common/utils/DateUtilsTest.java - **/common/utils/DependentUtilsTest.java - **/common/utils/EncryptionUtilsTest.java - **/common/utils/FileUtilsTest.java - **/common/utils/JSONUtilsTest.java - **/common/utils/LoggerUtilsTest.java - **/common/utils/NetUtilsTest.java - **/common/utils/ParameterUtilsTest.java - **/common/utils/TimePlaceholderUtilsTest.java - **/common/utils/PreconditionsTest.java - **/common/utils/PropertyUtilsTest.java - **/common/utils/SchemaUtilsTest.java - **/common/utils/ScriptRunnerTest.java - **/common/utils/SensitiveLogUtilsTest.java - **/common/utils/StringTest.java - **/common/utils/StringUtilsTest.java - **/common/utils/TaskParametersUtilsTest.java - **/common/utils/VarPoolUtilsTest.java - **/common/utils/HadoopUtilsTest.java - **/common/utils/HttpUtilsTest.java - **/common/utils/KerberosHttpClientTest.java - **/common/utils/HiveConfUtilsTest.java - **/common/ConstantsTest.java - **/common/utils/HadoopUtils.java - **/common/utils/RetryerUtilsTest.java - **/common/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java - **/common/datasource/db2/Db2DatasourceProcessorTest.java - **/common/datasource/hive/HiveDatasourceProcessorTest.java - **/common/datasource/mysql/MysqlDatasourceProcessorTest.java - **/common/datasource/oracle/OracleDatasourceProcessorTest.java - **/common/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java - **/common/datasource/presto/PrestoDatasourceProcessorTest.java - **/common/datasource/spark/SparkDatasourceProcessorTest.java - **/common/datasource/sqlserver/SqlServerDatasourceProcessorTest.java - **/common/datasource/DatasourceUtilTest.java - **/common/enums/ExecutionStatusTest - **/dao/mapper/AccessTokenMapperTest.java - **/dao/mapper/AlertGroupMapperTest.java - **/dao/mapper/CommandMapperTest.java - **/dao/mapper/ConnectionFactoryTest.java - **/dao/mapper/DataSourceMapperTest.java - **/dao/datasource/MySQLDataSourceTest.java - **/dao/entity/TaskInstanceTest.java - **/dao/entity/UdfFuncTest.java - **/remote/command/alert/AlertSendRequestCommandTest.java - **/remote/command/alert/AlertSendResponseCommandTest.java - **/remote/command/future/ResponseFutureTest.java - **/remote/command/log/RemoveTaskLogRequestCommandTest.java - **/remote/command/log/RemoveTaskLogResponseCommandTest.java - **/remote/command/log/GetLogBytesRequestCommandTest.java - **/remote/command/log/GetLogBytesResponseCommandTest.java - **/remote/command/log/ViewLogRequestCommandTest.java - **/remote/utils/HostTest.java - **/remote/utils/NettyUtilTest.java - **/remote/NettyRemotingClientTest.java - **/rpc/RpcTest.java - **/server/log/LoggerServerTest.java - **/server/entity/SQLTaskExecutionContextTest.java - **/server/log/MasterLogFilterTest.java - **/server/log/SensitiveDataConverterTest.java - **/server/log/LoggerRequestProcessorTest.java - - **/server/log/TaskLogFilterTest.java - **/server/log/WorkerLogFilterTest.java - **/server/master/cache/impl/TaskInstanceCacheManagerImplTest.java - **/server/master/config/MasterConfigTest.java - **/server/master/consumer/TaskPriorityQueueConsumerTest.java - **/server/master/runner/MasterTaskExecThreadTest.java - - **/server/master/dispatch/host/assign/LowerWeightRoundRobinTest.java - **/server/master/dispatch/host/assign/RandomSelectorTest.java - **/server/master/dispatch/host/assign/RoundRobinSelectorTest.java - **/server/master/dispatch/host/assign/HostWorkerTest.java - **/server/master/registry/MasterRegistryClientTest.java - **/server/master/registry/ServerNodeManagerTest.java - **/server/master/dispatch/host/RefreshResourceTaskTest.java - **/server/master/dispatch/host/assign/RoundRobinHostManagerTest.java - **/server/master/MasterCommandTest.java - **/server/master/DependentTaskTest.java - **/server/master/ConditionsTaskTest.java - **/server/master/SwitchTaskTest.java - **/server/master/MasterExecThreadTest.java - **/server/master/ParamsTest.java - **/server/master/SubProcessTaskTest.java - **/server/master/processor/TaskAckProcessorTest.java - **/server/master/processor/TaskKillResponseProcessorTest.java - **/server/master/processor/queue/TaskResponseServiceTest.java - **/server/master/zk/ZKMasterClientTest.java - **/server/registry/ZookeeperRegistryCenterTest.java - **/server/utils/DataxUtilsTest.java - **/server/utils/ExecutionContextTestUtils.java - **/server/utils/FlinkArgsUtilsTest.java - **/server/utils/LogUtilsTest.java - **/server/utils/MapReduceArgsUtilsTest.java - **/server/utils/ParamUtilsTest.java - **/server/utils/ProcessUtilsTest.java - **/server/utils/SparkArgsUtilsTest.java - **/server/worker/processor/TaskCallbackServiceTest.java - **/server/worker/processor/TaskExecuteProcessorTest.java - **/server/worker/registry/WorkerRegistryTest.java - **/server/worker/shell/ShellCommandExecutorTest.java - **/server/worker/sql/SqlExecutorTest.java - **/server/worker/task/spark/SparkTaskTest.java - **/server/worker/task/spark/SparkTaskTest.java - **/server/worker/task/datax/DataxTaskTest.java - - **/server/worker/task/sqoop/SqoopTaskTest.java - **/server/worker/task/processdure/ProcedureTaskTest.java - **/server/worker/task/shell/ShellTaskTest.java - **/server/worker/task/TaskManagerTest.java - **/server/worker/task/PythonCommandExecutorTest.java - **/server/worker/task/TaskParamsTest.java - **/server/worker/task/ShellTaskReturnTest.java - **/server/worker/task/sql/SqlTaskTest.java - **/server/worker/runner/TaskExecuteThreadTest.java - **/server/worker/runner/WorkerManagerThreadTest.java - **/service/quartz/cron/CronUtilsTest.java - **/service/process/ProcessServiceTest.java - **/service/registry/RegistryClientTest.java - **/service/registry/RegistryPluginTest.java - **/service/queue/TaskUpdateQueueTest.java - **/service/queue/PeerTaskInstancePriorityQueueTest.java - **/service/log/LogClientServiceTest.java - **/service/alert/AlertClientServiceTest.java - **/service/alert/ProcessAlertManagerTest.java - **/dao/mapper/DataSourceUserMapperTest.java - - **/dao/mapper/ProcessDefinitionMapperTest.java - **/dao/mapper/ProcessInstanceMapMapperTest.java - **/dao/mapper/ProcessInstanceMapperTest.java - **/dao/mapper/ProjectMapperTest.java - **/dao/mapper/ProjectUserMapperTest.java - **/dao/mapper/QueueMapperTest.java - **/dao/mapper/ResourceUserMapperTest.java - **/dao/mapper/ScheduleMapperTest.java - **/dao/mapper/SessionMapperTest.java - **/dao/mapper/TaskInstanceMapperTest.java - **/dao/mapper/TenantMapperTest.java - **/dao/mapper/UdfFuncMapperTest.java - **/dao/mapper/UDFUserMapperTest.java - **/dao/mapper/UserMapperTest.java - **/dao/mapper/AlertPluginInstanceMapperTest.java - **/dao/mapper/PluginDefineTest.java - **/dao/utils/DagHelperTest.java - **/dao/AlertDaoTest.java - **/dao/datasource/OracleDataSourceTest.java - **/dao/datasource/HiveDataSourceTest.java - **/dao/datasource/BaseDataSourceTest.java - **/dao/upgrade/ProcessDefinitionDaoTest.java - **/dao/upgrade/WokrerGrouopDaoTest.java - **/dao/upgrade/UpgradeDaoTest.java - **/plugin/alert/email/EmailAlertChannelFactoryTest.java - **/plugin/alert/email/EmailAlertChannelTest.java - **/plugin/alert/email/ExcelUtilsTest.java - **/plugin/alert/email/template/DefaultHTMLTemplateTest.java - **/plugin/alert/dingtalk/DingTalkSenderTest.java - **/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java - **/plugin/alert/wechat/WeChatSenderTest.java - **/plugin/alert/wechat/WeChatAlertChannelFactoryTest.java - **/plugin/alert/script/ProcessUtilsTest.java - **/plugin/alert/script/ScriptAlertChannelFactoryTest.java - **/plugin/alert/script/ScriptSenderTest.java - **/plugin/alert/http/HttpAlertChannelFactoryTest.java - **/plugin/alert/http/HttpAlertChannelTest.java - **/plugin/alert/feishu/FeiShuAlertChannelFactoryTest.java - **/plugin/alert/feishu/FeiShuSenderTest.java - **/plugin/alert/http/HttpAlertPluginTest.java - **/plugin/alert/http/HttpSenderTest.java - **/plugin/alert/slack/SlackAlertChannelFactoryTest.java - **/plugin/alert/slack/SlackAlertPluginTest.java - **/plugin/alert/slack/SlackSenderTest.java - **/spi/params/PluginParamsTransferTest.java - **/spi/plugin/DolphinSchedulerPluginLoaderTest.java - **/alert/plugin/EmailAlertPluginTest.java - **/alert/plugin/AlertPluginManagerTest.java - **/alert/plugin/DolphinPluginLoaderTest.java - **/alert/utils/FuncUtilsTest.java - **/alert/processor/AlertRequestProcessorTest.java - **/alert/runner/AlertSenderTest.java - **/alert/AlertServerTest.java - **/plugin/task/pigeon/PigeonTaskTest.java - - @@ -1142,6 +1000,7 @@ jacoco-maven-plugin ${jacoco.version} + ${jacoco.skip} ${project.build.directory}/jacoco.exec @@ -1237,9 +1096,41 @@ + + + + junit + junit + test + + + org.jacoco + org.jacoco.agent + ${jacoco.version} + runtime + test + + + org.springframework.boot + spring-boot-configuration-processor + true + + + com.google.auto.service + auto-service + ${auto-service.version} + provided + + + + dolphinscheduler-alert dolphinscheduler-spi - dolphinscheduler-alert-plugin dolphinscheduler-registry dolphinscheduler-task-plugin dolphinscheduler-ui @@ -1247,10 +1138,10 @@ dolphinscheduler-common dolphinscheduler-api dolphinscheduler-dao - dolphinscheduler-alert dolphinscheduler-dist dolphinscheduler-remote dolphinscheduler-service dolphinscheduler-standalone-server + dolphinscheduler-datasource-plugin diff --git a/script/dolphinscheduler-daemon.sh b/script/dolphinscheduler-daemon.sh index 4de812b979..41a7a1576c 100755 --- a/script/dolphinscheduler-daemon.sh +++ b/script/dolphinscheduler-daemon.sh @@ -45,6 +45,7 @@ export HOSTNAME=`hostname` export DOLPHINSCHEDULER_PID_DIR=$DOLPHINSCHEDULER_HOME/pid export DOLPHINSCHEDULER_LOG_DIR=$DOLPHINSCHEDULER_HOME/logs export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf +export DOLPHINSCHEDULER_SQL_DIR=$DOLPHINSCHEDULER_HOME/sql export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* export STOP_TIMEOUT=5 @@ -66,12 +67,12 @@ if [ "$command" = "api-server" ]; then HEAP_OPTS="-Xms1g -Xmx1g -Xmn512m" export DOLPHINSCHEDULER_OPTS="$HEAP_OPTS $DOLPHINSCHEDULER_OPTS $API_SERVER_OPTS" elif [ "$command" = "master-server" ]; then - LOG_FILE="-Dlogging.config=classpath:logback-master.xml -Ddruid.mysql.usePingMethod=false" + LOG_FILE="-Dlogging.config=classpath:logback-master.xml" CLASS=org.apache.dolphinscheduler.server.master.MasterServer HEAP_OPTS="-Xms4g -Xmx4g -Xmn2g" export DOLPHINSCHEDULER_OPTS="$HEAP_OPTS $DOLPHINSCHEDULER_OPTS $MASTER_SERVER_OPTS" elif [ "$command" = "worker-server" ]; then - LOG_FILE="-Dlogging.config=classpath:logback-worker.xml -Ddruid.mysql.usePingMethod=false" + LOG_FILE="-Dlogging.config=classpath:logback-worker.xml" CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer HEAP_OPTS="-Xms2g -Xmx2g -Xmn1g" export DOLPHINSCHEDULER_OPTS="$HEAP_OPTS $DOLPHINSCHEDULER_OPTS $WORKER_SERVER_OPTS" @@ -100,7 +101,7 @@ case $startStop in if [ "$DOCKER" = "true" ]; then echo start $command in docker export DOLPHINSCHEDULER_OPTS="$DOLPHINSCHEDULER_OPTS -XX:-UseContainerSupport" - exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS" + exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_SQL_DIR:$DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS" $JAVA_HOME/bin/java $exec_command else [ -w "$DOLPHINSCHEDULER_PID_DIR" ] || mkdir -p "$DOLPHINSCHEDULER_PID_DIR" @@ -113,7 +114,7 @@ case $startStop in fi echo starting $command, logging to $log - exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS" + exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath $DOLPHINSCHEDULER_SQL_DIR:$DOLPHINSCHEDULER_CONF_DIR:$DOLPHINSCHEDULER_LIB_JARS $CLASS" echo "nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 &" nohup $JAVA_HOME/bin/java $exec_command > $log 2>&1 & echo $! > $pid diff --git a/tools/dependencies/known-dependencies.txt b/tools/dependencies/known-dependencies.txt index b19e8b9d29..b2c9c2d9ba 100755 --- a/tools/dependencies/known-dependencies.txt +++ b/tools/dependencies/known-dependencies.txt @@ -1,38 +1,28 @@ -HikariCP-3.2.0.jar +HikariCP-4.0.3.jar activation-1.1.jar -aether-api-1.13.1.jar -aether-connector-asynchttpclient-1.13.1.jar -aether-connector-file-1.13.1.jar -aether-impl-1.13.1.jar -aether-spi-1.13.1.jar -aether-util-1.13.1.jar animal-sniffer-annotations-1.14.jar aopalliance-1.0.jar -apache-el-8.5.54.jar apacheds-i18n-2.0.0-M15.jar apacheds-kerberos-codec-2.0.0-M15.jar api-asn1-api-1.0.0-M20.jar api-util-1.0.0-M20.jar asm-3.1.jar asm-6.2.1.jar -aspectjweaver-1.9.6.jar -async-http-client-1.6.5.jar +aspectjweaver-1.9.7.jar audience-annotations-0.5.0.jar avro-1.7.4.jar aws-java-sdk-1.7.4.jar bonecp-0.8.0.RELEASE.jar byte-buddy-1.9.16.jar checker-compat-qual-2.0.0.jar -classmate-1.4.0.jar +classmate-1.5.1.jar clickhouse-jdbc-0.1.52.jar commons-email-1.5.jar commons-cli-1.2.jar commons-codec-1.11.jar commons-collections-3.2.2.jar commons-collections4-4.1.jar -commons-compress-1.19.jar commons-compress-1.4.1.jar -commons-compiler-3.0.16.jar commons-configuration-1.10.jar commons-daemon-1.0.13.jar commons-beanutils-1.9.4.jar @@ -42,10 +32,11 @@ commons-io-2.4.jar commons-lang-2.6.jar commons-logging-1.1.1.jar commons-math3-3.1.1.jar -commons-math3-3.6.1.jar commons-net-3.1.jar commons-pool-1.6.jar -cron-utils-5.0.5.jar +cron-utils-9.1.3.jar +javax.el-3.0.0.jar +commons-lang3-3.12.0.jar curator-client-4.3.0.jar curator-framework-4.3.0.jar curator-recipes-4.3.0.jar @@ -57,7 +48,7 @@ datanucleus-rdbms-4.1.7.jar derby-10.14.2.0.jar error_prone_annotations-2.1.3.jar druid-1.2.4.jar -gson-2.8.6.jar +gson-2.8.8.jar guava-24.1-jre.jar guava-retrying-2.0.0.jar guice-3.0.jar @@ -78,8 +69,6 @@ hadoop-yarn-api-2.7.3.jar hadoop-yarn-client-2.7.3.jar hadoop-yarn-common-2.7.3.jar hadoop-yarn-server-common-2.7.3.jar -hamcrest-core-1.3.jar -hibernate-validator-6.0.21.Final.jar hive-common-2.1.0.jar hive-jdbc-2.1.0.jar hive-metastore-2.1.0.jar @@ -97,26 +86,26 @@ jackson-annotations-2.10.5.jar jackson-core-2.10.5.jar jackson-core-asl-1.9.13.jar jackson-databind-2.10.5.jar -jackson-datatype-jdk8-2.9.10.jar -jackson-datatype-jsr310-2.9.10.jar +jackson-datatype-jdk8-2.12.5.jar +jackson-datatype-jsr310-2.12.5.jar jackson-jaxrs-1.9.13.jar jackson-mapper-asl-1.9.13.jar -jackson-module-parameter-names-2.9.10.jar +jackson-module-parameter-names-2.12.5.jar jackson-xc-1.9.13.jar +jakarta.annotation-api-1.3.5.jar +jakarta.servlet-api-4.0.4.jar +jakarta.websocket-api-1.1.2.jar jamon-runtime-2.3.1.jar -janino-3.0.16.jar java-xmlbuilder-0.4.jar javassist-3.26.0-GA.jar -javax.activation-api-1.2.0.jar javax.annotation-api-1.3.2.jar +javax.activation-api-1.2.0.jar javax.inject-1.jar javax.jdo-3.2.0-m3.jar javax.mail-1.6.2.jar -javax.servlet-api-3.1.0.jar javolution-5.5.1.jar jaxb-api-2.3.1.jar jaxb-impl-2.2.3-1.jar -jboss-logging-3.3.3.Final.jar jdo-api-3.0.1.jar jersey-client-1.9.jar jersey-core-1.9.jar @@ -126,50 +115,38 @@ jersey-server-1.9.jar jets3t-0.9.0.jar jettison-1.1.jar jetty-6.1.26.jar -jetty-continuation-9.4.33.v20201020.jar -jetty-http-9.4.33.v20201020.jar -jetty-io-9.4.33.v20201020.jar -jetty-security-9.4.33.v20201020.jar -jetty-server-9.4.33.v20201020.jar -jetty-servlet-9.4.33.v20201020.jar -jetty-servlets-9.4.33.v20201020.jar +jetty-continuation-9.4.44.v20210927.jar +jetty-http-9.4.44.v20210927.jar +jetty-io-9.4.44.v20210927.jar +jetty-security-9.4.44.v20210927.jar +jetty-server-9.4.44.v20210927.jar +jetty-servlet-9.4.44.v20210927.jar +jetty-servlets-9.4.44.v20210927.jar jetty-util-6.1.26.jar -jetty-util-9.4.33.v20201020.jar -jetty-webapp-9.4.33.v20201020.jar -jetty-xml-9.4.33.v20201020.jar +jetty-util-9.4.44.v20210927.jar +jetty-util-ajax-9.4.44.v20210927.jar +jetty-webapp-9.4.44.v20210927.jar +jetty-xml-9.4.44.v20210927.jar jline-0.9.94.jar jna-4.5.2.jar jna-platform-4.5.2.jar -joda-time-2.10.8.jar +joda-time-2.5.jar jpam-1.1.jar jsch-0.1.42.jar jsp-api-2.1.jar jsqlparser-2.1.jar -jsr305-1.3.9.jar jsr305-3.0.0.jar jta-1.1.jar -jul-to-slf4j-1.7.30.jar -junit-4.12.jar +jul-to-slf4j-1.7.32.jar leveldbjni-all-1.8.jar libfb303-0.9.3.jar libthrift-0.9.3.jar -log4j-1.2-api-2.11.2.jar +log4j-1.2-api-2.14.1.jar log4j-1.2.17.jar logback-classic-1.2.3.jar logback-core-1.2.3.jar lz4-1.3.0.jar mapstruct-1.2.0.Final.jar -maven-aether-provider-3.0.4.jar -maven-artifact-3.0.4.jar -maven-compat-3.0.4.jar -maven-core-3.0.4.jar -maven-embedder-3.0.4.jar -maven-model-3.0.4.jar -maven-model-builder-3.0.4.jar -maven-plugin-api-3.0.4.jar -maven-repository-metadata-3.0.4.jar -maven-settings-3.0.4.jar -maven-settings-builder-3.0.4.jar mssql-jdbc-6.1.0.jre8.jar mybatis-3.5.2.jar mybatis-plus-3.2.0.jar @@ -184,13 +161,6 @@ opencsv-2.3.jar oshi-core-3.9.1.jar paranamer-2.3.jar parquet-hadoop-bundle-1.8.1.jar -plexus-cipher-1.7.jar -plexus-classworlds-2.4.jar -plexus-component-annotations-1.5.5.jar -plexus-container-default-1.5.5.jar -plexus-interpolation-1.14.jar -plexus-sec-dispatcher-1.3.jar -plexus-utils-2.0.6.jar poi-4.1.2.jar poi-ooxml-4.1.2.jar poi-ooxml-schemas-4.1.2.jar @@ -204,33 +174,35 @@ protostuff-collectionschema-1.7.2.jar quartz-2.3.0.jar quartz-jobs-2.3.0.jar reflections-0.9.12.jar -resolver-1.5.jar slf4j-api-1.7.5.jar -snakeyaml-1.23.jar +snakeyaml-1.28.jar snappy-0.2.jar snappy-java-1.0.4.1.jar SparseBitSet-1.2.jar -spring-aop-5.1.19.RELEASE.jar -spring-beans-5.1.19.RELEASE.jar -spring-boot-2.1.18.RELEASE.jar -spring-boot-autoconfigure-2.1.18.RELEASE.jar -spring-boot-starter-2.1.18.RELEASE.jar -spring-boot-starter-aop-2.1.18.RELEASE.jar -spring-boot-starter-jdbc-2.1.18.RELEASE.jar -spring-boot-starter-jetty-2.1.18.RELEASE.jar -spring-boot-starter-json-2.1.18.RELEASE.jar -spring-boot-starter-logging-2.1.18.RELEASE.jar -spring-boot-starter-web-2.1.18.RELEASE.jar -spring-context-5.1.19.RELEASE.jar -spring-core-5.1.19.RELEASE.jar -spring-expression-5.1.19.RELEASE.jar -spring-jcl-5.1.19.RELEASE.jar -spring-jdbc-5.1.19.RELEASE.jar +spring-aop-5.3.12.jar +spring-beans-5.3.12.jar +spring-boot-2.5.6.jar +spring-boot-autoconfigure-2.5.6.jar +spring-boot-configuration-processor-2.5.6.jar +spring-boot-starter-2.5.6.jar +spring-boot-starter-aop-2.5.6.jar +spring-boot-starter-jdbc-2.5.6.jar +spring-boot-starter-jetty-2.5.6.jar +spring-boot-starter-json-2.5.6.jar +spring-boot-starter-logging-2.5.6.jar +spring-boot-starter-quartz-2.5.6.jar +spring-boot-starter-web-2.5.6.jar +spring-context-5.3.12.jar +spring-context-support-5.3.12.jar +spring-core-5.3.12.jar +spring-expression-5.3.12.jar +spring-jcl-5.3.12.jar +spring-jdbc-5.3.12.jar spring-plugin-core-1.2.0.RELEASE.jar spring-plugin-metadata-1.2.0.RELEASE.jar -spring-tx-5.1.19.RELEASE.jar -spring-web-5.1.19.RELEASE.jar -spring-webmvc-5.1.19.RELEASE.jar +spring-tx-5.3.12.jar +spring-web-5.3.12.jar +spring-webmvc-5.3.12.jar springfox-core-2.9.2.jar springfox-schema-2.9.2.jar springfox-spi-2.9.2.jar @@ -241,15 +213,13 @@ springfox-swagger2-2.9.2.jar swagger-annotations-1.5.20.jar swagger-bootstrap-ui-1.9.3.jar swagger-models-1.5.24.jar +tomcat-embed-el-9.0.54.jar tephra-api-0.6.0.jar transaction-api-1.1.jar -validation-api-2.0.1.Final.jar -wagon-provider-api-2.2.jar -xbean-reflect-3.4.jar xercesImpl-2.9.1.jar -xml-apis-1.4.01.jar +xml-apis-1.3.04.jar xmlbeans-3.1.0.jar xmlenc-0.52.jar xz-1.0.jar zookeeper-3.4.14.jar -Java-WebSocket-1.5.1.jar \ No newline at end of file +Java-WebSocket-1.5.1.jar