diff --git a/README.md b/README.md index 7bccebc56d..9582619611 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ dolphinscheduler-dist/target/apache-dolphinscheduler-${latest.release.version}-s ## Thanks -DolphinScheduler is based on a lot of excellent open-source projects, such as Google guava, guice, grpc, netty, ali bonecp, quartz, and many open-source projects of Apache and so on. +DolphinScheduler is based on a lot of excellent open-source projects, such as Google guava, guice, grpc, netty, quartz, and many open-source projects of Apache and so on. We would like to express our deep gratitude to all the open-source projects used in Dolphin Scheduler. We hope that we are not only the beneficiaries of open-source, but also give back to the community. Besides, we hope everyone who have the same enthusiasm and passion for open source could join in and contribute to the open-source community! ## Get Help @@ -92,7 +92,7 @@ We would like to express our deep gratitude to all the open-source projects used You are very welcome to communicate with the developers and users of Dolphin Scheduler. There are two ways to find them: 1. Join the Slack channel by [this invitation link](https://join.slack.com/t/asf-dolphinscheduler/shared_invite/zt-omtdhuio-_JISsxYhiVsltmC5h38yfw). -2. Follow the [Twitter account of Dolphin Scheduler](https://twitter.com/dolphinschedule) and get the latest news on time. +2. Follow the [Twitter account of DolphinScheduler](https://twitter.com/dolphinschedule) and get the latest news on time. ### Contributor over time diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java index b0f07b6f88..61518b6cbf 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java @@ -24,9 +24,9 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.RadioParam; +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; 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 index 41395fc01f..2eefb4932f 100644 --- 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 @@ -26,9 +26,9 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.RadioParam; +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; 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 index 2ddd42ebde..9a87709e9a 100644 --- 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 @@ -22,11 +22,10 @@ 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.InputParam; +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.RadioParam; -import org.apache.dolphinscheduler.spi.params.base.DataType; +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; @@ -142,7 +141,7 @@ public class EmailAlertChannelTest { 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") - .setParamsOptionsList(emailShowTypeList) + .setOptions(emailShowTypeList) .setValue(ShowType.TABLE.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java index d85b4233a5..6eb3376a4d 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java @@ -24,9 +24,9 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.PasswordParam; -import org.apache.dolphinscheduler.spi.params.RadioParam; +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; 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 index 6b8dd305fd..d54885eb7f 100644 --- 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 @@ -19,7 +19,7 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java index 4d385e8a54..2d29407e71 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java @@ -20,7 +20,7 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java index a81cb4f12e..67cfc3931f 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java @@ -19,8 +19,8 @@ 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.InputParam; -import org.apache.dolphinscheduler.spi.params.RadioParam; +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; diff --git a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java index f3f135ebec..d56976400a 100644 --- a/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java +++ b/dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java @@ -19,7 +19,7 @@ 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.InputParam; +import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; 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 index 636c571322..25b1318f42 100644 --- 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 @@ -21,8 +21,8 @@ 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.InputParam; -import org.apache.dolphinscheduler.spi.params.RadioParam; +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; diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java index 6d1727f1e4..5c31225edc 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java +++ b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java @@ -32,10 +32,10 @@ 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.InputParam; +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.RadioParam; +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; @@ -217,7 +217,7 @@ public class EmailAlertPluginTest { 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") - .setParamsOptionsList(emailShowTypeList) + .setOptions(emailShowTypeList) .setValue(ShowType.TABLE.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml index a16480fd6a..fec3342cf1 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml @@ -80,7 +80,9 @@ left join t_ds_user tu on td.user_id = tu.id where td.project_code = #{projectCode} - and td.name like concat('%', #{searchVal}, '%') + AND (td.name like concat('%', #{searchVal}, '%') + OR td.description like concat('%', #{searchVal}, '%') + ) and td.user_id = #{userId} diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml index 59a24731fe..1b44c22158 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml @@ -88,7 +88,9 @@ ) - and p.name like concat('%', #{searchName}, '%') + AND (p.name LIKE concat('%', #{searchName}, '%') + OR p.description LIKE concat('%', #{searchName}, '%') + ) order by p.create_time desc diff --git a/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml b/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml index e5689b8bb2..557a993da6 100644 --- a/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml +++ b/dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml @@ -74,4 +74,10 @@ + + + + + + \ No newline at end of file diff --git a/dolphinscheduler-server/pom.xml b/dolphinscheduler-server/pom.xml index 03544ad713..7c59fb6955 100644 --- a/dolphinscheduler-server/pom.xml +++ b/dolphinscheduler-server/pom.xml @@ -86,6 +86,7 @@ org.springframework spring-test + test 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 91566b11a8..cd744a1998 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 @@ -17,14 +17,17 @@ package org.apache.dolphinscheduler.server.worker; +import com.google.common.collect.ImmutableList; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.IStoppable; import org.apache.dolphinscheduler.common.enums.NodeType; import org.apache.dolphinscheduler.common.thread.Stopper; +import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.remote.NettyRemotingServer; 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.TaskExecuteProcessor; @@ -39,6 +42,9 @@ import java.util.Set; import javax.annotation.PostConstruct; +import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader; +import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig; +import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -101,6 +107,8 @@ public class WorkerServer implements IStoppable { @Autowired private WorkerManagerThread workerManagerThread; + private TaskPluginManager taskPluginManager; + /** * worker server startup, not use web service * @@ -119,11 +127,13 @@ 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()); this.nettyRemotingServer = new NettyRemotingServer(serverConfig); - this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService)); + this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService, taskPluginManager)); this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_REQUEST, new TaskKillProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_ACK, new DBTaskAckProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_RESPONSE, new DBTaskResponseProcessor()); @@ -157,6 +167,26 @@ public class WorkerServer implements IStoppable { })); } + 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 alertPluginLoader = new DolphinPluginLoader(taskPluginManagerConfig, ImmutableList.of(taskPluginManager)); + try { + alertPluginLoader.loadPlugins(); + } catch (Exception e) { + throw new RuntimeException("Load Task Plugin Failed !", e); + } + } + public void close(String cause) { try { diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java index 2c71a97f30..a3feb7777d 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java @@ -56,6 +56,15 @@ public class WorkerConfig { @Value("${alert.listen.host:localhost}") private String alertListenHost; + @Value("${task.plugin.dir:}") + private String taskPluginDir; + + @Value("${maven.local.repository:}") + private String mavenLocalRepository; + + @Value("${task.plugin.binding:}") + private String taskPluginBinding; + public int getListenPort() { return listenPort; } @@ -130,4 +139,28 @@ public class WorkerConfig { public void setAlertListenHost(String alertListenHost) { this.alertListenHost = alertListenHost; } + + public String getTaskPluginDir() { + return taskPluginDir; + } + + public void setTaskPluginDir(String taskPluginDir) { + this.taskPluginDir = taskPluginDir; + } + + public String getMavenLocalRepository() { + return mavenLocalRepository; + } + + public void setMavenLocalRepository(String mavenLocalRepository) { + this.mavenLocalRepository = mavenLocalRepository; + } + + public String getTaskPluginBinding() { + return taskPluginBinding; + } + + public void setTaskPluginBinding(String taskPluginBinding) { + this.taskPluginBinding = taskPluginBinding; + } } \ No newline at end of file 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 7f51d8daea..a76a1bb661 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 @@ -83,6 +83,10 @@ public class TaskPluginManager extends AbstractDolphinPluginManager { private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); + public Map getTaskChannelMap() { + return taskChannelMap; + } + @Override public void installPlugin(DolphinSchedulerPlugin dolphinSchedulerPlugin) { for (TaskChannelFactory taskChannelFactory : dolphinSchedulerPlugin.getTaskChannelFactorys()) { diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java index 047dc6d9ed..718c9490ba 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java @@ -39,6 +39,7 @@ import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; +import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager; import org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.alert.AlertClientService; @@ -74,6 +75,8 @@ public class TaskExecuteProcessor implements NettyRequestProcessor { */ private AlertClientService alertClientService; + private TaskPluginManager taskPluginManager; + /** * taskExecutionContextCacheManager */ @@ -102,9 +105,10 @@ public class TaskExecuteProcessor implements NettyRequestProcessor { taskExecutionContextCacheManager.cacheTaskExecutionContext(preTaskCache); } - public TaskExecuteProcessor(AlertClientService alertClientService) { + public TaskExecuteProcessor(AlertClientService alertClientService, TaskPluginManager taskPluginManager) { this(); this.alertClientService = alertClientService; + this.taskPluginManager = taskPluginManager; } @Override @@ -177,7 +181,7 @@ public class TaskExecuteProcessor implements NettyRequestProcessor { this.doAck(taskExecutionContext); // submit task to manager - if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService))) { + if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService, taskPluginManager))) { logger.info("submit task to manager error, queue is full, queue size is {}", workerManager.getQueueSize()); } } 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 50847f7e13..597529406d 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 @@ -35,8 +35,8 @@ import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; +import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager; import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; -import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.dolphinscheduler.server.worker.task.TaskManager; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; @@ -55,6 +55,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import org.apache.dolphinscheduler.spi.task.AbstractTask; +import org.apache.dolphinscheduler.spi.task.TaskChannel; +import org.apache.dolphinscheduler.spi.task.TaskRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,14 +103,17 @@ public class TaskExecuteThread implements Runnable, Delayed { */ private AlertClientService alertClientService; + private TaskPluginManager taskPluginManager; + /** * constructor * @param taskExecutionContext taskExecutionContext * @param taskCallbackService taskCallbackService */ - public TaskExecuteThread(TaskExecutionContext taskExecutionContext - , TaskCallbackService taskCallbackService - , Logger taskLogger, AlertClientService alertClientService) { + public TaskExecuteThread(TaskExecutionContext taskExecutionContext, + TaskCallbackService taskCallbackService, + Logger taskLogger, + AlertClientService alertClientService) { this.taskExecutionContext = taskExecutionContext; this.taskCallbackService = taskCallbackService; this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); @@ -115,6 +121,19 @@ public class TaskExecuteThread implements Runnable, Delayed { this.alertClientService = alertClientService; } + public TaskExecuteThread(TaskExecutionContext taskExecutionContext, + TaskCallbackService taskCallbackService, + Logger taskLogger, + AlertClientService alertClientService, + TaskPluginManager taskPluginManager) { + this.taskExecutionContext = taskExecutionContext; + this.taskCallbackService = taskCallbackService; + this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); + this.taskLogger = taskLogger; + this.alertClientService = alertClientService; + this.taskPluginManager = taskPluginManager; + } + @Override public void run() { @@ -150,24 +169,31 @@ public class TaskExecuteThread implements Runnable, Delayed { taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId())); - task = TaskManager.newTask(taskExecutionContext, taskLogger, alertClientService); + TaskChannel taskChannel = taskPluginManager.getTaskChannelMap().get(taskExecutionContext.getTaskType()); + + //TODO Temporary operation, To be adjusted + TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class); + task = taskChannel.createTask(taskRequest, taskLogger); // task init - task.init(); + this.task.init(); //init varPool - task.getParameters().setVarPool(taskExecutionContext.getVarPool()); + //TODO Temporary operation, To be adjusted +// this.task.getParameters().setVarPool(taskExecutionContext.getVarPool()); // task handle - task.handle(); + this.task.handle(); // task result process - task.after(); + this.task.after(); - responseCommand.setStatus(task.getExitStatus().getCode()); + responseCommand.setStatus(this.task.getExitStatus().getCode()); responseCommand.setEndTime(new Date()); - responseCommand.setProcessId(task.getProcessId()); - responseCommand.setAppIds(task.getAppIds()); - responseCommand.setVarPool(JSONUtils.toJsonString(task.getParameters().getVarPool())); - logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), task.getExitStatus()); - } catch (Exception e) { + responseCommand.setProcessId(this.task.getProcessId()); + responseCommand.setAppIds(this.task.getAppIds()); + //TODO Temporary operation, To be adjusted +// responseCommand.setVarPool(JSONUtils.toJsonString(this.task.getParameters().getVarPool())); + logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), this.task.getExitStatus()); + } catch (Throwable e) { + e.printStackTrace(); logger.error("task scheduler failure", e); kill(); responseCommand.setStatus(ExecutionStatus.FAILURE.getCode()); diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java index 9dd8b516ed..3c4b3ab273 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java @@ -42,6 +42,8 @@ import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; +import org.apache.commons.collections.MapUtils; + import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -271,11 +273,11 @@ public class SqlTask extends AbstractTask { public String setNonQuerySqlReturn(String updateResult, List properties) { String result = null; - for (Property info :properties) { + for (Property info : properties) { if (Direct.OUT == info.getDirect()) { - List> updateRL = new ArrayList<>(); - Map updateRM = new HashMap<>(); - updateRM.put(info.getProp(),updateResult); + List> updateRL = new ArrayList<>(); + Map updateRM = new HashMap<>(); + updateRM.put(info.getProp(), updateResult); updateRL.add(updateRM); result = JSONUtils.toJsonString(updateRL); break; @@ -490,6 +492,10 @@ public class SqlTask extends AbstractTask { public void printReplacedSql(String content, String formatSql, String rgex, Map sqlParamsMap) { //parameter print style logger.info("after replace sql , preparing : {}", formatSql); + if (MapUtils.isEmpty(sqlParamsMap)) { + logger.info("sqlParamsMap should not be Empty"); + return; + } StringBuilder logPrint = new StringBuilder("replaced sql , parameters:"); if (sqlParamsMap == null) { logger.info("printReplacedSql: sqlParamsMap is null."); diff --git a/dolphinscheduler-server/src/main/resources/worker.properties b/dolphinscheduler-server/src/main/resources/worker.properties index 2c37e5309b..59887fca34 100644 --- a/dolphinscheduler-server/src/main/resources/worker.properties +++ b/dolphinscheduler-server/src/main/resources/worker.properties @@ -41,3 +41,11 @@ # alert server listen host #alert.listen.host=localhost + +#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 . +#task.plugin.dir=lib/plugin/task + +#maven.local.repository=/Users/localRepository + +#task.plugin.binding config the task plugin need be load when development and run in IDE +#task.plugin.binding=./dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java index 5d6234e753..ad692505d6 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java @@ -22,8 +22,20 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum FormType { INPUT("input"), - - RADIO("radio"); + INPUTNUMBER("inputNumber"), + RADIO("radio"), + SELECT("select"), + SWITCH("switch"), + CHECKBOX("checkbox"), + TIMEPICKER("timePicker"), + DATEPICKER("datePicker"), + SLIDER("slider"), + RATE("rate"), + COLORPICKER("colorPicker"), + CASCADER("cascader"), + UPLOAD("upload"), + ELTRANSFER("el-transfer"), + TREE("tree"); private String formType; diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java index cab65ba645..08d6844aa5 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java @@ -26,8 +26,16 @@ public class ParamsProps { private String placeholder; + /** + * input box size, optional value medium/small/mini + */ private String size = "small"; + /** + * whether to disable, the default value is false + */ + private Boolean disabled; + public void setSize(String size) { this.size = size; } @@ -47,4 +55,11 @@ public class ParamsProps { return this; } + public Boolean getDisabled() { + return disabled; + } + + public void setDisabled(Boolean disabled) { + this.disabled = disabled; + } } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java index cf85781aa4..042446a7c4 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java @@ -81,12 +81,12 @@ public class PluginParams { /** * whether to hide, the default value is false */ - protected boolean hidden; + protected Boolean hidden; /** * whether to display, the default value is true */ - protected boolean display; + protected Boolean display; protected PluginParams(Builder builder) { @@ -132,9 +132,9 @@ public class PluginParams { protected List validateList; - protected boolean hidden; + protected Boolean hidden; - protected boolean display; + protected Boolean display; public Builder(String name, FormType formType, @@ -158,8 +158,8 @@ public class PluginParams { @JsonProperty("name") String fieldName, @JsonProperty("validate") List validateList, @JsonProperty("info") String info, - @JsonProperty("hidden") boolean hidden, - @JsonProperty("display") boolean display + @JsonProperty("hidden") Boolean hidden, + @JsonProperty("display") Boolean display ) { requireNonNull(name, "name is null"); requireNonNull(formType, "formType is null"); diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ResizeType.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ResizeType.java new file mode 100644 index 0000000000..466594eb98 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ResizeType.java @@ -0,0 +1,32 @@ +/* + * 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.params.base; + +public enum ResizeType { + + NONE("none"), + BOTH("both"), + HORIZONTAL("horizontal"), + VERTICAL("vertical"); + + private String value; + + ResizeType(String value) { + this.value = value; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParam.java new file mode 100644 index 0000000000..65468d30bd --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParam.java @@ -0,0 +1,87 @@ +package org.apache.dolphinscheduler.spi.params.checkbox; + +import static org.apache.dolphinscheduler.spi.params.base.FormType.CHECKBOX; + +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; + +import java.util.ArrayList; +import java.util.List; + +/** + * front-end checkbox component + */ +public class CheckboxParam extends PluginParams { + + private CheckboxParam(Builder builder) { + super(builder); + } + + private CheckboxParamProps props; + + public static Builder newBuilder(String name, String title) { + return new Builder(name, title); + } + + public static class Builder extends PluginParams.Builder { + + public Builder(String name, String title) { + super(name, CHECKBOX, title); + } + + private CheckboxParamProps props; + + public Builder setProps(CheckboxParamProps props) { + this.props = props; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setTitle(String title) { + this.title = title; + return this; + } + + public Builder setInfo(String info) { + this.info = info; + return this; + } + + public Builder setValue(Object value) { + this.value = value; + return this; + } + + public Builder setValidateList(List validateList) { + this.validateList = validateList; + return this; + } + + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); + return this; + } + + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } + + public Builder setDisplay(Boolean display) { + this.display = display; + return this; + } + } + + @Override + public CheckboxParamProps getProps() { + return props; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParamProps.java new file mode 100644 index 0000000000..8d5192f9a5 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParamProps.java @@ -0,0 +1,61 @@ +package org.apache.dolphinscheduler.spi.params.checkbox; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; + +/** + * front-end checkbox component props attributes + */ +public class CheckboxParamProps extends ParamsProps { + + /** + * the minimum number of checkboxes that can be checked + */ + private Integer min; + + /** + * the maximum number of checkboxes that can be checked + */ + private Integer max; + + /** + * the color of the text when the Checkbox in the form of a button is activated + */ + private String textColor; + + /** + * the fill color and border color of the Checkbox in the form of a button when activated + */ + private String fill; + + public Integer getMin() { + return min; + } + + public void setMin(Integer min) { + this.min = min; + } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } + + public String getTextColor() { + return textColor; + } + + public void setTextColor(String textColor) { + this.textColor = textColor; + } + + public String getFill() { + return fill; + } + + public void setFill(String fill) { + this.fill = fill; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParam.java new file mode 100644 index 0000000000..b6bfe17cf9 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParam.java @@ -0,0 +1,104 @@ +/* + * 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.params.fswitch; + +import static org.apache.dolphinscheduler.spi.params.base.FormType.SWITCH; + +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; + +import java.util.ArrayList; +import java.util.List; + +/** + * front-end switch component + */ +public class SwitchParam extends PluginParams { + + private SwitchParam(Builder builder) { + super(builder); + } + + private SwitchParamProps props; + + public static Builder newBuilder(String name, String title) { + return new Builder(name, title); + } + + public static class Builder extends PluginParams.Builder { + + public Builder(String name, String title) { + super(name, SWITCH, title); + } + + private SwitchParamProps props; + + public Builder setProps(SwitchParamProps props) { + this.props = props; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setTitle(String title) { + this.title = title; + return this; + } + + public Builder setInfo(String info) { + this.info = info; + return this; + } + + public Builder setValue(Object value) { + this.value = value; + return this; + } + + public Builder setValidateList(List validateList) { + this.validateList = validateList; + return this; + } + + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); + return this; + } + + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } + + public Builder setDisplay(Boolean display) { + this.display = display; + return this; + } + } + + @Override + public SwitchParamProps getProps() { + return props; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParamProps.java new file mode 100644 index 0000000000..53de57101a --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParamProps.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.spi.params.fswitch; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; + +/** + * front-end switch component props attributes + */ +public class SwitchParamProps extends ParamsProps { + + /** + * the width of the switch (pixels) + */ + private Integer width; + + /** + * the class name of the icon displayed when the switch is turned on, setting this option will ignore active-text + */ + private String activeIconClass; + + /** + * the class name of the icon displayed when the switch is closed, setting this option will ignore inactive-text + */ + private String inactiveIconClass; + + /** + * text description when switch is turned on + */ + private String activeText; + + /** + * text description when switch is closed + */ + private String inactiveText; + + /** + * value when switch is turned on + */ + private Object activeValue; + + /** + * value when the switch is closed + */ + private Object inactiveValue; + + /** + * the background color when the switch is turned on + */ + private String activeColor; + + /** + * the background color when the switch is closed + */ + private String inactiveColor; + + /** + * name attribute + */ + private String name; + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public String getActiveIconClass() { + return activeIconClass; + } + + public void setActiveIconClass(String activeIconClass) { + this.activeIconClass = activeIconClass; + } + + public String getInactiveIconClass() { + return inactiveIconClass; + } + + public void setInactiveIconClass(String inactiveIconClass) { + this.inactiveIconClass = inactiveIconClass; + } + + public String getActiveText() { + return activeText; + } + + public void setActiveText(String activeText) { + this.activeText = activeText; + } + + public String getInactiveText() { + return inactiveText; + } + + public void setInactiveText(String inactiveText) { + this.inactiveText = inactiveText; + } + + public Object getActiveValue() { + return activeValue; + } + + public void setActiveValue(Object activeValue) { + this.activeValue = activeValue; + } + + public Object getInactiveValue() { + return inactiveValue; + } + + public void setInactiveValue(Object inactiveValue) { + this.inactiveValue = inactiveValue; + } + + public String getActiveColor() { + return activeColor; + } + + public void setActiveColor(String activeColor) { + this.activeColor = activeColor; + } + + public String getInactiveColor() { + return inactiveColor; + } + + public void setInactiveColor(String inactiveColor) { + this.inactiveColor = inactiveColor; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/InputParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParam.java similarity index 75% rename from dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/InputParam.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParam.java index 894d05c692..a771f9796e 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/InputParam.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParam.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.spi.params; +package org.apache.dolphinscheduler.spi.params.input; + +import static org.apache.dolphinscheduler.spi.params.base.FormType.INPUT; -import org.apache.dolphinscheduler.spi.params.base.FormType; -import org.apache.dolphinscheduler.spi.params.base.ParamsProps; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; @@ -33,6 +33,8 @@ public class InputParam extends PluginParams { private InputParam(Builder builder) { super(builder); } + + private InputParamProps props; public static Builder newBuilder(String name, String title) { return new Builder(name, title); @@ -41,38 +43,37 @@ public class InputParam extends PluginParams { public static class Builder extends PluginParams.Builder { public Builder(String name, String title) { - super(name, FormType.INPUT, title); + super(name, INPUT, title); } + private InputParamProps props; + + public Builder setProps(InputParamProps props) { + this.props = props; + return this; + } + public Builder setPlaceholder(String placeholder) { if (this.props == null) { - this.setProps(new ParamsProps()); + this.setProps(new InputParamProps()); } this.props.setPlaceholder(placeholder); return this; } - public Builder addValidate(Validate validate) { - if (this.validateList == null) { - this.validateList = new ArrayList<>(); - } - this.validateList.add(validate); - return this; - } - public Builder setName(String name) { this.name = name; return this; } - public Builder setProps(ParamsProps props) { - this.props = props; + public Builder setTitle(String title) { + this.title = title; return this; } - public Builder setTitle(String title) { - this.title = title; + public Builder setInfo(String info) { + this.info = info; return this; } @@ -86,9 +87,32 @@ public class InputParam extends PluginParams { return this; } + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); + return this; + } + + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } + + public Builder setDisplay(Boolean display) { + this.display = display; + return this; + } + @Override public InputParam build() { return new InputParam(this); } } + + @Override + public InputParamProps getProps() { + return props; + } } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParamProps.java new file mode 100644 index 0000000000..f352e61c4f --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParamProps.java @@ -0,0 +1,297 @@ +/* + * 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.params.input; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; +import org.apache.dolphinscheduler.spi.params.base.ResizeType; + +/** + * front-end input component props attributes + */ +public class InputParamProps extends ParamsProps { + + /** + * input type + */ + private String type; + + /** + * maximum input length + */ + private Integer maxlength; + + /** + * minimum input length + */ + private Integer minlength; + + /** + * whether it can be cleared, the default value is false + */ + private Boolean clearable; + + /** + * input box head icon + */ + private String prefixIcon; + + /** + * input box end icon + */ + private String suffixIcon; + + /** + * number of lines in the input box, only valid for type="textarea" + */ + private Integer rows; + + /** + * adaptive content height, only valid for type="textarea", objects can be passed in, such as {minRows: 2, maxRows: 6} + */ + private Object autosize; + + /** + * autocomplete attribute:on, off + */ + private String autocomplete; + + /** + * name attribute + */ + private String name; + + /** + * whether it is read-only, the default value is false + */ + private Boolean readonly; + + /** + * set maximum + */ + private Integer max; + + /** + * set minimum + */ + private Integer min; + + /** + * set the legal number interval of the input field + */ + private Integer step; + + /** + * control whether it can be zoomed by the user, the value is none, both, horizontal, vertical + */ + private ResizeType resize; + + /** + * get focus automatically, the default value is false + */ + private Boolean autofocus; + + private String form; + + /** + * the label text associated with the input box + */ + private String label; + + /** + * tabindex of the input box + */ + private String tabindex; + + /** + * whether to trigger the verification of the form during input, the default value is true + */ + private Boolean validateEvent; + + /** + * whether to display the switch password icon + */ + private Boolean showPassword; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getMaxlength() { + return maxlength; + } + + public void setMaxlength(Integer maxlength) { + this.maxlength = maxlength; + } + + public Integer getMinlength() { + return minlength; + } + + public void setMinlength(Integer minlength) { + this.minlength = minlength; + } + + public Boolean getClearable() { + return clearable; + } + + public void setClearable(Boolean clearable) { + this.clearable = clearable; + } + + public String getPrefixIcon() { + return prefixIcon; + } + + public void setPrefixIcon(String prefixIcon) { + this.prefixIcon = prefixIcon; + } + + public String getSuffixIcon() { + return suffixIcon; + } + + public void setSuffixIcon(String suffixIcon) { + this.suffixIcon = suffixIcon; + } + + public Integer getRows() { + return rows; + } + + public void setRows(Integer rows) { + this.rows = rows; + } + + public Object getAutosize() { + return autosize; + } + + public void setAutosize(Object autosize) { + this.autosize = autosize; + } + + public String getAutocomplete() { + return autocomplete; + } + + public void setAutocomplete(String autocomplete) { + this.autocomplete = autocomplete; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getReadonly() { + return readonly; + } + + public void setReadonly(Boolean readonly) { + this.readonly = readonly; + } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } + + public Integer getMin() { + return min; + } + + public void setMin(Integer min) { + this.min = min; + } + + public Integer getStep() { + return step; + } + + public void setStep(Integer step) { + this.step = step; + } + + public ResizeType getResize() { + return resize; + } + + public void setResize(ResizeType resize) { + this.resize = resize; + } + + public Boolean getAutofocus() { + return autofocus; + } + + public void setAutofocus(Boolean autofocus) { + this.autofocus = autofocus; + } + + public String getForm() { + return form; + } + + public void setForm(String form) { + this.form = form; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getTabindex() { + return tabindex; + } + + public void setTabindex(String tabindex) { + this.tabindex = tabindex; + } + + public Boolean getValidateEvent() { + return validateEvent; + } + + public void setValidateEvent(Boolean validateEvent) { + this.validateEvent = validateEvent; + } + + public Boolean getShowPassword() { + return showPassword; + } + + public void setShowPassword(Boolean showPassword) { + this.showPassword = showPassword; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParam.java new file mode 100644 index 0000000000..71c905bc19 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParam.java @@ -0,0 +1,104 @@ +/* + * 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.params.inputNumber; + +import static org.apache.dolphinscheduler.spi.params.base.FormType.INPUTNUMBER; + +import org.apache.dolphinscheduler.spi.params.base.PluginParams; +import org.apache.dolphinscheduler.spi.params.base.Validate; + +import java.util.ArrayList; +import java.util.List; + +/** + * front-end input number component + */ +public class InputNumberParam extends PluginParams { + + private InputNumberParam(Builder builder) { + super(builder); + } + + private InputNumberParamProps props; + + public static Builder newBuilder(String name, String title) { + return new Builder(name, title); + } + + public static class Builder extends PluginParams.Builder { + + public Builder(String name, String title) { + super(name, INPUTNUMBER, title); + } + + private InputNumberParamProps props; + + public Builder setProps(InputNumberParamProps props) { + this.props = props; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setTitle(String title) { + this.title = title; + return this; + } + + public Builder setInfo(String info) { + this.info = info; + return this; + } + + public Builder setValue(Object value) { + this.value = value; + return this; + } + + public Builder setValidateList(List validateList) { + this.validateList = validateList; + return this; + } + + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); + return this; + } + + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } + + public Builder setDisplay(Boolean display) { + this.display = display; + return this; + } + } + + @Override + public InputNumberParamProps getProps() { + return props; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParamProps.java new file mode 100644 index 0000000000..dbb469e8a6 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParamProps.java @@ -0,0 +1,130 @@ +/* + * 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.params.inputNumber; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; + +/** + * front-end input number component props attributes + */ +public class InputNumberParamProps extends ParamsProps { + + /** + * set the minimum value allowed by the counter + */ + private Integer min; + + /** + * set the maximum value allowed by the counter + */ + private Integer max; + + /** + * counter step + */ + private Integer step; + + /** + * numerical accuracy + */ + private Integer precision; + + /** + * whether to use the control button, the default value is true + */ + private Boolean controls; + + /** + * control button position, the default value is right + */ + private String controlsPosition; + + /** + * name attribute + */ + private String name; + + /** + * the label text associated with the input box + */ + private String label; + + public Integer getMin() { + return min; + } + + public void setMin(Integer min) { + this.min = min; + } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } + + public Integer getStep() { + return step; + } + + public void setStep(Integer step) { + this.step = step; + } + + public Integer getPrecision() { + return precision; + } + + public void setPrecision(Integer precision) { + this.precision = precision; + } + + public Boolean getControls() { + return controls; + } + + public void setControls(Boolean controls) { + this.controls = controls; + } + + public String getControlsPosition() { + return controlsPosition; + } + + public void setControlsPosition(String controlsPosition) { + this.controlsPosition = controlsPosition; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/RadioParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java similarity index 67% rename from dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/RadioParam.java rename to dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java index 70e0b5cb3f..8d4411a8fa 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/RadioParam.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.dolphinscheduler.spi.params; +package org.apache.dolphinscheduler.spi.params.radio; +import static org.apache.dolphinscheduler.spi.params.base.FormType.RADIO; import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_OPTIONS; -import org.apache.dolphinscheduler.spi.params.base.FormType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; @@ -30,16 +30,18 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; /** - * radio + * front-end radio select component */ public class RadioParam extends PluginParams { @JsonProperty(STRING_PLUGIN_PARAM_OPTIONS) - private List paramsOptionsList; + private List options; + + private RadioParamProps props; private RadioParam(Builder builder) { super(builder); - this.paramsOptionsList = builder.paramsOptionsList; + this.options = builder.options; } public static Builder newBuilder(String name, String title) { @@ -48,17 +50,30 @@ public class RadioParam extends PluginParams { public static class Builder extends PluginParams.Builder { - private List paramsOptionsList; - public Builder(String name, String title) { - super(name, FormType.RADIO, title); + super(name, RADIO, title); } + + private List options; - public Builder addValidate(Validate validate) { - if (this.validateList == null) { - this.validateList = new ArrayList<>(); + private RadioParamProps props; + + public Builder setOptions(List options) { + this.options = options; + return this; + } + + public Builder addParamsOptions(ParamsOptions paramsOptions) { + if (this.options == null) { + this.options = new ArrayList<>(); } - this.validateList.add(validate); + + this.options.add(paramsOptions); + return this; + } + + public Builder setProps(RadioParamProps props) { + this.props = props; return this; } @@ -72,6 +87,11 @@ public class RadioParam extends PluginParams { return this; } + public Builder setInfo(String info) { + this.info = info; + return this; + } + public Builder setValue(Object value) { this.value = value; return this; @@ -82,17 +102,21 @@ public class RadioParam extends PluginParams { return this; } - public Builder setParamsOptionsList(List paramsOptionsList) { - this.paramsOptionsList = paramsOptionsList; + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); return this; } - public Builder addParamsOptions(ParamsOptions paramsOptions) { - if (this.paramsOptionsList == null) { - this.paramsOptionsList = new ArrayList<>(); - } + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } - this.paramsOptionsList.add(paramsOptions); + public Builder setDisplay(Boolean display) { + this.display = display; return this; } @@ -102,7 +126,12 @@ public class RadioParam extends PluginParams { } } - public List getParamsOptionsList() { - return paramsOptionsList; + public List getOptions() { + return options; + } + + @Override + public RadioParamProps getProps() { + return props; } } diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParamProps.java new file mode 100644 index 0000000000..f558f7579a --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParamProps.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.spi.params.radio; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; + +/** + * front-end radio component props attributes + */ +public class RadioParamProps extends ParamsProps { + + /** + * the color of the text when Radio is activated in the form of a button + */ + private String textColor; + + /** + * the fill color and border color of the button form of Radio when activated + */ + private String fill; + + public String getTextColor() { + return textColor; + } + + public void setTextColor(String textColor) { + this.textColor = textColor; + } + + public String getFill() { + return fill; + } + + public void setFill(String fill) { + this.fill = fill; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java new file mode 100644 index 0000000000..7ac27585db --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java @@ -0,0 +1,127 @@ +/* + * 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.params.select; + +import static org.apache.dolphinscheduler.spi.params.base.FormType.SELECT; + +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; + +/** + * front-end select component + */ +public class SelectParam extends PluginParams { + + private List options; + + private SelectParamProps props; + + private SelectParam(Builder builder) { + super(builder); + } + + public static Builder newBuilder(String name, String title) { + return new Builder(name, title); + } + + public static class Builder extends PluginParams.Builder { + + public Builder(String name, String title) { + super(name, SELECT, title); + } + + private List options; + + private SelectParamProps props; + + public Builder setOptions(List options) { + this.options = options; + return this; + } + + public Builder addOptions(ParamsOptions paramsOptions) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + + this.options.add(paramsOptions); + return this; + } + + public Builder setProps(SelectParamProps props) { + this.props = props; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setTitle(String title) { + this.title = title; + return this; + } + + public Builder setInfo(String info) { + this.info = info; + return this; + } + + public Builder setValue(Object value) { + this.value = value; + return this; + } + + public Builder setValidateList(List validateList) { + this.validateList = validateList; + return this; + } + + public Builder addValidate(Validate validate) { + if (this.validateList == null) { + this.validateList = new ArrayList<>(); + } + this.validateList.add(validate); + return this; + } + + public Builder setHidden(Boolean hidden) { + this.hidden = hidden; + return this; + } + + public Builder setDisplay(Boolean display) { + this.display = display; + return this; + } + } + + public List getOptions() { + return options; + } + + @Override + public SelectParamProps getProps() { + return props; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParamProps.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParamProps.java new file mode 100644 index 0000000000..a8a68ee631 --- /dev/null +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParamProps.java @@ -0,0 +1,239 @@ +/* + * 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.params.select; + +import org.apache.dolphinscheduler.spi.params.base.ParamsProps; + +/** + * front-end select component props attributes + */ +public class SelectParamProps extends ParamsProps { + + /** + * whether to select multiple, the default value is false + */ + private Boolean multiple; + + /** + * as the key name that uniquely identifies the value, it is required when the binding value is the object type + */ + private String valueKey; + + /** + * input box size, optional value medium/small/mini + */ + private String size; + + /** + * whether the option can be cleared, the default value is false + */ + private Boolean clearable; + + /** + * whether to display the selected value in the form of text when multiple selections, the default value is false + */ + private Boolean collapseTags; + + /** + * the maximum number of items that the user can select when multiple selections are made, if it is 0, there is no limit + */ + private Integer multipleLimit; + + /** + * select input name attribute + */ + private String name; + + /** + * select input autocomplete attribute, the default value is off + */ + private String autocomplete; + + /** + * whether it is searchable, the default value is false + */ + private Boolean filterable; + + /** + * whether to allow users to create new entries, it needs to be used with filterable, the default value is false + */ + private Boolean allowCreate; + + /** + * the text displayed when there is no match for the search criteria + */ + private String noMatchText; + + /** + * the text displayed when the option is empty + */ + private String noDataText; + + /** + * Select the class name of the drop-down box + */ + private String popperClass; + + /** + * when multiple selection and searchable, whether to keep the current search keywords after selecting an option, the default value is false + */ + private Boolean reserveKeyword; + + /** + * press Enter in the input box to select the first match. need to be used with filterable or remote, the default value is false + */ + private Boolean defaultFirstOption; + + /** + * whether to insert a pop-up box into the body element. when there is a problem with the positioning of the pop-up box, this property can be set to false + */ + private Boolean popperAppendToBody; + + /** + * for non-searchable Select, whether to automatically pop up the option menu after the input box gets the focus, the default value is false + */ + private Boolean automaticDropdown; + + public Boolean getMultiple() { + return multiple; + } + + public void setMultiple(Boolean multiple) { + this.multiple = multiple; + } + + public String getValueKey() { + return valueKey; + } + + public void setValueKey(String valueKey) { + this.valueKey = valueKey; + } + + public Boolean getClearable() { + return clearable; + } + + public void setClearable(Boolean clearable) { + this.clearable = clearable; + } + + public Boolean getCollapseTags() { + return collapseTags; + } + + public void setCollapseTags(Boolean collapseTags) { + this.collapseTags = collapseTags; + } + + public Integer getMultipleLimit() { + return multipleLimit; + } + + public void setMultipleLimit(Integer multipleLimit) { + this.multipleLimit = multipleLimit; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAutocomplete() { + return autocomplete; + } + + public void setAutocomplete(String autocomplete) { + this.autocomplete = autocomplete; + } + + public Boolean getFilterable() { + return filterable; + } + + public void setFilterable(Boolean filterable) { + this.filterable = filterable; + } + + public Boolean getAllowCreate() { + return allowCreate; + } + + public void setAllowCreate(Boolean allowCreate) { + this.allowCreate = allowCreate; + } + + public String getNoMatchText() { + return noMatchText; + } + + public void setNoMatchText(String noMatchText) { + this.noMatchText = noMatchText; + } + + public String getNoDataText() { + return noDataText; + } + + public void setNoDataText(String noDataText) { + this.noDataText = noDataText; + } + + public String getPopperClass() { + return popperClass; + } + + public void setPopperClass(String popperClass) { + this.popperClass = popperClass; + } + + public Boolean getReserveKeyword() { + return reserveKeyword; + } + + public void setReserveKeyword(Boolean reserveKeyword) { + this.reserveKeyword = reserveKeyword; + } + + public Boolean getDefaultFirstOption() { + return defaultFirstOption; + } + + public void setDefaultFirstOption(Boolean defaultFirstOption) { + this.defaultFirstOption = defaultFirstOption; + } + + public Boolean getPopperAppendToBody() { + return popperAppendToBody; + } + + public void setPopperAppendToBody(Boolean popperAppendToBody) { + this.popperAppendToBody = popperAppendToBody; + } + + public Boolean getAutomaticDropdown() { + return automaticDropdown; + } + + public void setAutomaticDropdown(Boolean automaticDropdown) { + this.automaticDropdown = automaticDropdown; + } +} diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java index a4cee9d60b..5a3a5249e8 100644 --- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java +++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java @@ -21,6 +21,6 @@ public interface TaskChannel { void cancelApplication(boolean status); - AbstractTask createTask(TaskRequest taskRequest,Logger logger); + AbstractTask createTask(TaskRequest taskRequest, Logger logger); } diff --git a/dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java b/dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java index a4d93d6cd0..48a60d0f95 100644 --- a/dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java +++ b/dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java @@ -25,6 +25,8 @@ import org.apache.dolphinscheduler.spi.params.base.Validate; import java.util.ArrayList; import java.util.List; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -110,7 +112,7 @@ public class PluginParamsTransferTest { emailShowTypeList.add(new ParamsOptions("attachment", "attachment", false)); emailShowTypeList.add(new ParamsOptions("tableattachment", "tableattachment", false)); RadioParam showType = new RadioParam.Builder("showType", "showType") - .setParamsOptionsList(emailShowTypeList) + .setOptions(emailShowTypeList) .setValue("table") .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml index 01fb97f957..75f87cb8a7 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml @@ -41,13 +41,14 @@ com.google.guava guava - - org.slf4j - slf4j-api - ch.qos.logback logback-classic + + + org.slf4j + slf4j-api + \ No newline at end of file diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml index ae261a4d0b..94d280b3f4 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml @@ -37,6 +37,11 @@ dolphinscheduler-task-api ${project.version} + + org.slf4j + slf4j-api + provided + \ No newline at end of file diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml index 2d620af538..fa11c520e1 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml @@ -38,6 +38,12 @@ dolphinscheduler-task-api ${project.version} + + + org.slf4j + slf4j-api + provided + diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml index abf19745ca..a753e9028d 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml @@ -26,6 +26,7 @@ 4.0.0 dolphinscheduler-task-shell + dolphinscheduler-plugin @@ -38,9 +39,9 @@ dolphinscheduler-task-api ${project.version} - - org.slf4j - slf4j-api - + + + dolphinscheduler-task-shell-${project.version} + \ No newline at end of file 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 fd154e4669..63f283aed6 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 @@ -17,10 +17,15 @@ package org.apache.dolphinscheduler.plugin.task.shell; +import org.apache.dolphinscheduler.spi.params.input.InputParam; +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.radio.RadioParam; import org.apache.dolphinscheduler.spi.task.TaskChannel; import org.apache.dolphinscheduler.spi.task.TaskChannelFactory; +import java.util.ArrayList; import java.util.List; public class ShellTaskChannelFactory implements TaskChannelFactory { @@ -31,11 +36,26 @@ public class ShellTaskChannelFactory implements TaskChannelFactory { @Override public String getName() { - return "Shell"; + return "SHELL"; } @Override public List getParams() { - return null; + List paramsList = new ArrayList<>(); + + InputParam nodeName = InputParam.newBuilder("name", "$t('Node name')") + .addValidate(Validate.newBuilder() + .setRequired(true) + .build()) + .build(); + + RadioParam runFlag = RadioParam.newBuilder("runFlag", "运行标志") + .addParamsOptions(new ParamsOptions("NORMAL", "NORMAL", false)) + .addParamsOptions(new ParamsOptions("FORBIDDEN", "FORBIDDEN", false)) + .build(); + + paramsList.add(nodeName); + paramsList.add(runFlag); + return paramsList; } } diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskConstants.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskConstants.java new file mode 100644 index 0000000000..95fe00b669 --- /dev/null +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskConstants.java @@ -0,0 +1,25 @@ +/* + * 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; + +public class ShellTaskConstants { + + private ShellTaskConstants() { + + } +} diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml index 7245c35655..51b4cb4d20 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml @@ -36,6 +36,12 @@ dolphinscheduler-task-api ${project.version} + + + org.slf4j + slf4j-api + provided + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 37524d1977..522d9b1ab9 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ 6.1.0.jre8 0.238.1 3.1.12 - 3.0.0 + 3.1.2 3.4.14 2.12.0 1.6 @@ -206,6 +206,11 @@ dolphinscheduler-server ${project.version} + + org.apache.dolphinscheduler + dolphinscheduler-standalone-server + ${project.version} + org.apache.dolphinscheduler dolphinscheduler-common @@ -310,7 +315,6 @@ org.apache.curator curator-test ${curator.test} - test commons-codec @@ -661,7 +665,6 @@ javax.mail 1.6.2 - @@ -899,7 +902,6 @@ **/api/utils/ResultTest.java **/common/graph/DAGTest.java **/common/os/OshiTest.java - **/common/os/OSUtilsTest.java **/common/shell/ShellExecutorTest.java **/common/task/DataxParametersTest.java **/common/task/EntityTestUtils.java @@ -919,7 +921,6 @@ **/common/utils/JSONUtilsTest.java **/common/utils/LoggerUtilsTest.java **/common/utils/NetUtilsTest.java - **/common/utils/OSUtilsTest.java **/common/utils/ParameterUtilsTest.java **/common/utils/TimePlaceholderUtilsTest.java **/common/utils/PreconditionsTest.java @@ -991,6 +992,7 @@ **/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 @@ -1065,7 +1067,6 @@ **/plugin/alert/email/EmailAlertChannelFactoryTest.java **/plugin/alert/email/EmailAlertChannelTest.java **/plugin/alert/email/ExcelUtilsTest.java - **/plugin/alert/email/MailUtilsTest.java **/plugin/alert/email/template/DefaultHTMLTemplateTest.java **/plugin/alert/dingtalk/DingTalkSenderTest.java **/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java @@ -1153,15 +1154,13 @@ com.puppycrawl.tools checkstyle - 8.18 + 8.45 true UTF-8 style/checkstyle.xml - style/checkstyle-suppressions.xml - checkstyle.suppressions.file true warning true @@ -1169,7 +1168,6 @@ ${project.build.sourceDirectory} **\/generated-sources\/ - true @@ -1215,5 +1213,6 @@ dolphinscheduler-remote dolphinscheduler-service dolphinscheduler-microbench + dolphinscheduler-standalone-server