This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 7298d631a27 CAMEL-19774: camel-jbang - Rename command: pipe to script 7298d631a27 is described below commit 7298d631a275e0cbb41afb2a3fe3e0717480f236 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Sep 23 13:49:10 2023 +0200 CAMEL-19774: camel-jbang - Rename command: pipe to script --- .../modules/ROOT/pages/camel-4x-upgrade-guide-4_1.adoc | 10 ++++++++-- .../camel/dsl/jbang/core/commands/CamelJBangMain.java | 2 +- .../java/org/apache/camel/dsl/jbang/core/commands/Run.java | 12 ++++++------ .../dsl/jbang/core/commands/{Pipe.java => Script.java} | 14 +++++++------- .../apache/camel/dsl/jbang/core/common/RuntimeUtil.java | 6 +++--- .../{log4j2-pipe.properties => log4j2-script.properties} | 2 +- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_1.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_1.adoc index 22f2f9f0d62..246b3e864f8 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_1.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_1.adoc @@ -116,8 +116,9 @@ from("direct:start") The Camel-PDF component has been updated to Apache PDFBox 3.0.0 and the font parameter is now defined through the following enum values: COURIER,COURIER_BOLD,COURIER_OBLIQUE,COURIER_BOLD_OBLIQUE, HELVETICA,HELVETICA_BOLD,HELVETICA_OBLIQUE,HELVETICA_BOLD_OBLIQUE,TIMES_ROMAN,TIMES_BOLD,TIMES_ITALIC,TIMES_BOLD_ITALIC,SYMBOL and ZAPF_DINGBATS -=== YAML DSL -The kebab-case style schema file, `camel-yaml-dsl.json` has been removed from the distribution in favor of the camelCase style schema file, `camelYamlDsl.json`. While the Camel runtime stays supporting kebab-case style also for the moment, it is recommended to migrate to camelCase style. Any tooling should encourage users to use camelCase style. +=== camel-jbang + +The `pipe` command has been renamed to `script`. === camel-jetty / camel-servlet / camel-atmosphere-websocket / camel-http-common @@ -136,3 +137,8 @@ For example ---- from("jetty:http://localhost:{{port}}/myapp/myservice?logException=true") ---- + +=== YAML DSL + +The kebab-case style schema file, `camel-yaml-dsl.json` has been removed from the distribution in favor of the camelCase style schema file, `camelYamlDsl.json`. While the Camel runtime stays supporting kebab-case style also for the moment, it is recommended to migrate to camelCase style. Any tooling should encourage users to use camelCase style. + diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java index 4c303bcd73b..78310fa8e6a 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java @@ -139,7 +139,7 @@ public class CamelJBangMain implements Callable<Integer> { .addSubcommand("jolokia", new CommandLine(new Jolokia(main))) .addSubcommand("hawtio", new CommandLine(new Hawtio(main))) .addSubcommand("bind", new CommandLine(new Bind(main))) - .addSubcommand("pipe", new CommandLine(new Pipe(main))) + .addSubcommand("script", new CommandLine(new Script(main))) .addSubcommand("export", new CommandLine(new Export(main))) .addSubcommand("completion", new CommandLine(new Complete(main))) .addSubcommand("config", new CommandLine(new ConfigCommand(main)) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java index f29b9e49091..04e99fbbc8b 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java @@ -109,7 +109,7 @@ public class Run extends CamelCommand { "^\\s*public class\\s+([a-zA-Z0-9]*)[\\s+|;].*$", Pattern.MULTILINE); private boolean silentRun; - private boolean pipeRun; + private boolean scriptRun; private boolean transformRun; private File logFile; @@ -280,9 +280,9 @@ public class Run extends CamelCommand { return run(); } - protected Integer runPipe(String file) throws Exception { + protected Integer runScript(String file) throws Exception { this.files.add(file); - pipeRun = true; + scriptRun = true; return run(); } @@ -468,7 +468,7 @@ public class Run extends CamelCommand { main.addInitialProperty("camel.main.autoStartup", "false"); main.addInitialProperty("camel.main.durationMaxSeconds", "1"); main.addInitialProperty("camel.main.durationMaxSeconds", "1"); - } else if (pipeRun) { + } else if (scriptRun) { // auto terminate if being idle main.addInitialProperty("camel.main.durationMaxIdleSeconds", "1"); } @@ -1054,11 +1054,11 @@ public class Run extends CamelCommand { if (silentRun) { // do not configure logging } else if (logging) { - RuntimeUtil.configureLog(loggingLevel, loggingColor, loggingJson, pipeRun, false); + RuntimeUtil.configureLog(loggingLevel, loggingColor, loggingJson, scriptRun, false); writeSettings("loggingLevel", loggingLevel); writeSettings("loggingColor", loggingColor ? "true" : "false"); writeSettings("loggingJson", loggingJson ? "true" : "false"); - if (!pipeRun) { + if (!scriptRun) { // remember log file File dir = new File(System.getProperty("user.home"), ".camel"); String name = RuntimeUtil.getPid() + ".log"; diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Pipe.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java similarity index 88% rename from dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Pipe.java rename to dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java index 0d9261a93e1..290caf592dc 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Pipe.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java @@ -22,9 +22,9 @@ import java.util.Stack; import org.apache.camel.dsl.jbang.core.common.LoggingLevelCompletionCandidates; import picocli.CommandLine; -@CommandLine.Command(name = "pipe", description = "Run Camel integration in pipe and filters mode for terminal scripting", +@CommandLine.Command(name = "script", description = "Run Camel integration as shell script for terminal scripting", sortOptions = false) -public class Pipe extends CamelCommand { +public class Script extends CamelCommand { @CommandLine.Parameters(description = "Name of file", arity = "1", paramLabel = "<file>", parameterConsumer = FileConsumer.class) @@ -58,7 +58,7 @@ public class Pipe extends CamelCommand { arity = "0") String[] property; - public Pipe(CamelJBangMain main) { + public Script(CamelJBangMain main) { super(main); } @@ -69,7 +69,7 @@ public class Pipe extends CamelCommand { @Override public Integer doCall() throws Exception { - // remove leading ./ when calling a script in pipe mode + // remove leading ./ when calling a script in script mode if (file != null && file.startsWith("./")) { file = file.substring(2); } @@ -83,12 +83,12 @@ public class Pipe extends CamelCommand { run.maxIdleSeconds = maxIdleSeconds; run.property = property; run.propertiesFiles = propertiesFiles; - return run.runPipe(file); + return run.runScript(file); } - static class FileConsumer extends ParameterConsumer<Pipe> { + static class FileConsumer extends ParameterConsumer<Script> { @Override - protected void doConsumeParameters(Stack<String> args, Pipe cmd) { + protected void doConsumeParameters(Stack<String> args, Script cmd) { cmd.file = args.pop(); } } diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java index 5ab46ea33af..1f1952aed31 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java @@ -33,15 +33,15 @@ public final class RuntimeUtil { } public static void configureLog( - String level, boolean color, boolean json, boolean pipe, boolean export) { + String level, boolean color, boolean json, boolean script, boolean export) { if (INIT_DONE.compareAndSet(false, true)) { long pid = ProcessHandle.current().pid(); System.setProperty("pid", Long.toString(pid)); if (export) { Configurator.initialize("CamelJBang", "log4j2-export.properties"); - } else if (pipe) { - Configurator.initialize("CamelJBang", "log4j2-pipe.properties"); + } else if (script) { + Configurator.initialize("CamelJBang", "log4j2-script.properties"); } else if (json) { Configurator.initialize("CamelJBang", "log4j2-json.properties"); } else if (color) { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-pipe.properties b/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-script.properties similarity index 95% rename from dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-pipe.properties rename to dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-script.properties index 1349f98ad8d..55fdfe92d08 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-pipe.properties +++ b/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2-script.properties @@ -17,7 +17,7 @@ appender.file.type = File appender.file.name = file -appender.file.fileName = ${sys:user.home}/.camel/camel-pipe.log +appender.file.fileName = ${sys:user.home}/.camel/camel-script.log appender.file.createOnDemand = true appender.file.append = false