diff options
| author | doufenghu <[email protected]> | 2024-03-06 20:19:27 +0800 |
|---|---|---|
| committer | doufenghu <[email protected]> | 2024-03-06 20:19:27 +0800 |
| commit | f3ecbcc30d01c70bb96634c36c4d1ca7f1e0e869 (patch) | |
| tree | cb33ab4a8452d436f8336f3bed4a37981fe99f62 | |
| parent | e1334d60e9421d18404541186c5ef6212a34c6e0 (diff) | |
[Feature][Bootstrap] You can use the CLI 'start.sh --version -c config_file' to get current version.
5 files changed, 43 insertions, 1 deletions
@@ -111,4 +111,6 @@ The [User Guide](docs/user-guide.md) provides detailed information on how to con See the [Groot Stream Documentation](docs) for more information. +## Contributors +All developers see the list of contributors [here](https://git.mesalab.cn/galaxy/platform/groot-stream/-/graphs/develop?ref_type=heads). diff --git a/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ConfVersionCommand.java b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ConfVersionCommand.java new file mode 100644 index 0000000..3d46c97 --- /dev/null +++ b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ConfVersionCommand.java @@ -0,0 +1,32 @@ +package com.geedgenetworks.bootstrap.command; + +import com.geedgenetworks.bootstrap.exception.CommandExecuteException; +import com.geedgenetworks.bootstrap.exception.ConfigCheckException; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.ResourceBundle; + +public class ConfVersionCommand implements Command<ExecuteCommandArgs> { + private final ExecuteCommandArgs executeCommandArgs; + public ConfVersionCommand(ExecuteCommandArgs executeCommandArgs) { + this.executeCommandArgs = executeCommandArgs; + } + + @Override + public void execute() throws CommandExecuteException, ConfigCheckException { + try (InputStream input = ConfVersionCommand.class.getClassLoader().getResourceAsStream("META-INF/maven/com.geedgenetworks/groot-bootstrap/pom.properties")) { + if (input == null) { + System.out.println("pom.properties file not found."); + return; + } + Properties prop = new Properties(); + prop.load(input); + String version = prop.getProperty("version"); + System.out.println("Current version: " + version); + } catch (IOException ex) { + ex.printStackTrace(); + } + } +} diff --git a/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ExecuteCommandArgs.java b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ExecuteCommandArgs.java index a6ccadc..0c00a61 100644 --- a/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ExecuteCommandArgs.java +++ b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/command/ExecuteCommandArgs.java @@ -38,6 +38,10 @@ public class ExecuteCommandArgs extends CommandArgs { return new ConfValidateCommand(this); } + if(version) { + return new ConfVersionCommand(this); + } + if (encrypt) { return new ConfEncryptCommand(this); } diff --git a/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/main/GrootStreamRunner.java b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/main/GrootStreamRunner.java index 20da905..8ab8bdc 100644 --- a/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/main/GrootStreamRunner.java +++ b/groot-bootstrap/src/main/java/com/geedgenetworks/bootstrap/main/GrootStreamRunner.java @@ -55,6 +55,10 @@ public class GrootStreamRunner { if(bootstrapCommandArgs.isCheckConfig()) { command.add("--check"); } + // set version flag + if(bootstrapCommandArgs.isVersion()) { + command.add("--version"); + } // set job name command.add("--name"); command.add(bootstrapCommandArgs.getJobName()); diff --git a/groot-core/src/main/resources/META-INF/services/com.geedgenetworks.core.factories.Factory b/groot-core/src/main/resources/META-INF/services/com.geedgenetworks.core.factories.Factory index 6d6a1bb..21e390d 100644 --- a/groot-core/src/main/resources/META-INF/services/com.geedgenetworks.core.factories.Factory +++ b/groot-core/src/main/resources/META-INF/services/com.geedgenetworks.core.factories.Factory @@ -1,2 +1,2 @@ com.geedgenetworks.core.connector.inline.InlineTableFactory -com.geedgenetworks.core.connector.print.PrintTableFactory +com.geedgenetworks.core.connector.print.PrintTableFactory
\ No newline at end of file |
