You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/10/04 08:21:09 UTC

[camel] branch master updated (54e103a -> 582a576)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 54e103a  Upgrade Hazelcast to version 3.12.3
     new 30affd0  CAMEL-14031: Move command line stuff from MainSupport to special class.
     new 582a576  Regen

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/sjms-batch-component.adoc        |   4 +-
 .../camel-sjms/src/main/docs/sjms-component.adoc   |   4 +-
 .../main/java/org/apache/camel/spring/Main.java    |   2 +-
 .../java/org/apache/camel/test/blueprint/Main.java |   4 +-
 .../src/main/java/org/apache/camel/main/Main.java  |   2 +-
 .../apache/camel/main/MainCommandLineSupport.java  | 190 +++++++++++++++++++++
 .../java/org/apache/camel/main/MainSupport.java    | 156 +----------------
 .../camel/main/MainSupportCommandLineTest.java     |   2 +-
 .../modules/ROOT/pages/sjms-batch-component.adoc   |   2 +-
 .../modules/ROOT/pages/sjms-component.adoc         |   4 +-
 10 files changed, 207 insertions(+), 163 deletions(-)
 create mode 100644 core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java


[camel] 02/02: Regen

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 582a5763250ec7224409659852459607d69428c7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 4 10:12:03 2019 +0200

    Regen
---
 components/camel-sjms/src/main/docs/sjms-batch-component.adoc | 4 +++-
 components/camel-sjms/src/main/docs/sjms-component.adoc       | 4 +++-
 docs/components/modules/ROOT/pages/sjms-batch-component.adoc  | 2 +-
 docs/components/modules/ROOT/pages/sjms-component.adoc        | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/components/camel-sjms/src/main/docs/sjms-batch-component.adoc b/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
index 371b05d..d3c308e 100644
--- a/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
+++ b/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
@@ -1,6 +1,8 @@
 [[sjms-batch-component]]
 = Simple JMS Batch Component
 
+*Available as of Camel version 2.16*
+
 SJMS Batch is a specialized component for highly performant,
 transactional batch consumption from a JMS queue. It can be thought of
 as a hybrid of a consumer-only component and an
@@ -222,4 +224,4 @@ The component supports 6 options, which are listed below.
 
 The `completionSize` endpoint attribute is used in conjunction with
 `completionTimeout`, where the first condition to be met will cause the
-aggregated `Exchange` to be emitted down the route.
+aggregated `Exchange` to be emitted down the route.
\ No newline at end of file
diff --git a/components/camel-sjms/src/main/docs/sjms-component.adoc b/components/camel-sjms/src/main/docs/sjms-component.adoc
index f3bc0bb..8adbfa2 100644
--- a/components/camel-sjms/src/main/docs/sjms-component.adoc
+++ b/components/camel-sjms/src/main/docs/sjms-component.adoc
@@ -1,6 +1,8 @@
 [[sjms-component]]
 = Simple JMS Component
 
+*Available as of Camel version 2.11*
+
 The Simple JMS Component, or SJMS, is a JMS client for use with Camel
 that uses well known best practices when it comes to JMS client creation
 and configuration. SJMS contains a brand new JMS client API written
@@ -592,4 +594,4 @@ DSL:
 
 Springless refers to moving away from the dependency on the Spring JMS
 API. A new JMS client API is being developed from the ground up to power
-SJMS.
+SJMS.
\ No newline at end of file
diff --git a/docs/components/modules/ROOT/pages/sjms-batch-component.adoc b/docs/components/modules/ROOT/pages/sjms-batch-component.adoc
index 4175230..0600d26 100644
--- a/docs/components/modules/ROOT/pages/sjms-batch-component.adoc
+++ b/docs/components/modules/ROOT/pages/sjms-batch-component.adoc
@@ -225,4 +225,4 @@ The component supports 6 options, which are listed below.
 
 The `completionSize` endpoint attribute is used in conjunction with
 `completionTimeout`, where the first condition to be met will cause the
-aggregated `Exchange` to be emitted down the route.
+aggregated `Exchange` to be emitted down the route.
\ No newline at end of file
diff --git a/docs/components/modules/ROOT/pages/sjms-component.adoc b/docs/components/modules/ROOT/pages/sjms-component.adoc
index 35b6971..2072a18 100644
--- a/docs/components/modules/ROOT/pages/sjms-component.adoc
+++ b/docs/components/modules/ROOT/pages/sjms-component.adoc
@@ -564,6 +564,8 @@ reducing the overhead on the broker since all the messages are consumed
 from the destination in the order they are produced by the interested
 consumer.
 
+NOTE: You should only use queues as destination types, topics is not recommended or fully supported.
+
 Currently the only correlation strategy is to use the `JMSCorrelationId`.
 The _InOut_ Consumer uses this strategy as well ensuring that all
 responses messages to the included `JMSReplyTo` destination also have the
@@ -593,4 +595,4 @@ DSL:
 
 Springless refers to moving away from the dependency on the Spring JMS
 API. A new JMS client API is being developed from the ground up to power
-SJMS.
+SJMS.
\ No newline at end of file


[camel] 01/02: CAMEL-14031: Move command line stuff from MainSupport to special class.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 30affd0c599231ae50cc832b1f222d90b6bad290
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 4 10:09:37 2019 +0200

    CAMEL-14031: Move command line stuff from MainSupport to special class.
---
 .../main/java/org/apache/camel/spring/Main.java    |   2 +-
 .../java/org/apache/camel/test/blueprint/Main.java |   4 +-
 .../src/main/java/org/apache/camel/main/Main.java  |   2 +-
 .../apache/camel/main/MainCommandLineSupport.java  | 190 +++++++++++++++++++++
 .../java/org/apache/camel/main/MainSupport.java    | 156 +----------------
 .../camel/main/MainSupportCommandLineTest.java     |   2 +-
 6 files changed, 197 insertions(+), 159 deletions(-)

diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
index 0c53020..3a845d6 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
@@ -47,7 +47,7 @@ import org.springframework.context.support.FileSystemXmlApplicationContext;
  * Each line in the {@link #LOCATION_PROPERTIES} is a reference to a Spring XML file to include,
  * which by default gets loaded from classpath.
  */
-public class Main extends org.apache.camel.main.MainSupport {
+public class Main extends org.apache.camel.main.MainCommandLineSupport {
 
     public static final String LOCATION_PROPERTIES = "META-INF/camel-spring/location.properties";
     protected static Main instance;
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
index fef2be5..db5efa5 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
@@ -20,13 +20,13 @@ import java.util.LinkedList;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
-import org.apache.camel.main.MainSupport;
+import org.apache.camel.main.MainCommandLineSupport;
 import org.osgi.framework.BundleContext;
 
 /**
  * A command line tool for booting up a CamelContext using an OSGi Blueprint XML file
  */
-public class Main extends MainSupport {
+public class Main extends MainCommandLineSupport {
 
     protected static Main instance;
     private BundleContext bundleContext;
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/Main.java b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
index dd025e2..ac51b86 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/Main.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
@@ -26,7 +26,7 @@ import org.apache.camel.spi.Registry;
 /**
  * A Main class for booting up Camel in standalone mode.
  */
-public class Main extends MainSupport {
+public class Main extends MainCommandLineSupport {
 
     protected static Main instance;
     protected final MainRegistry registry = new MainRegistry();
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
new file mode 100644
index 0000000..06cc53c
--- /dev/null
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainCommandLineSupport.java
@@ -0,0 +1,190 @@
+/*
+ * 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.camel.main;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Support for command line arguments to Camel main.
+ */
+public abstract class MainCommandLineSupport extends MainSupport {
+
+    protected final List<Option> options = new ArrayList<>();
+
+    public MainCommandLineSupport(Class... configurationClasses) {
+        super(configurationClasses);
+    }
+
+    public MainCommandLineSupport() {
+        addOption(new Option("h", "help", "Displays the help screen") {
+            protected void doProcess(String arg, LinkedList<String> remainingArgs) {
+                showOptions();
+                completed();
+            }
+        });
+        addOption(new ParameterOption("r", "routers",
+                "Sets the router builder classes which will be loaded while starting the camel context",
+                "routerBuilderClasses") {
+            @Override
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                setRouteBuilderClasses(parameter);
+            }
+        });
+        addOption(new ParameterOption("d", "duration",
+                "Sets the time duration (seconds) that the application will run for before terminating.",
+                "duration") {
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                // skip second marker to be backwards compatible
+                if (parameter.endsWith("s") || parameter.endsWith("S")) {
+                    parameter = parameter.substring(0, parameter.length() - 1);
+                }
+                configure().setDurationMaxSeconds(Integer.parseInt(parameter));
+            }
+        });
+        addOption(new ParameterOption("dm", "durationMaxMessages",
+                "Sets the duration of maximum number of messages that the application will process before terminating.",
+                "durationMaxMessages") {
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                configure().setDurationMaxMessages(Integer.parseInt(parameter));
+            }
+        });
+        addOption(new ParameterOption("di", "durationIdle",
+                "Sets the idle time duration (seconds) duration that the application can be idle before terminating.",
+                "durationIdle") {
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                // skip second marker to be backwards compatible
+                if (parameter.endsWith("s") || parameter.endsWith("S")) {
+                    parameter = parameter.substring(0, parameter.length() - 1);
+                }
+                configure().setDurationMaxIdleSeconds(Integer.parseInt(parameter));
+            }
+        });
+        addOption(new Option("t", "trace", "Enables tracing") {
+            protected void doProcess(String arg, LinkedList<String> remainingArgs) {
+                enableTrace();
+            }
+        });
+        addOption(new ParameterOption("e", "exitcode",
+                "Sets the exit code if duration was hit",
+                "exitcode") {
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                configure().setDurationHitExitCode(Integer.parseInt(parameter));
+            }
+        });
+        addOption(new ParameterOption("pl", "propertiesLocation",
+                "Sets location(s) to load properties, such as from classpath or file system.",
+                "propertiesLocation") {
+            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
+                setPropertyPlaceholderLocations(parameter);
+            }
+        });
+    }
+
+    /**
+     * Displays the command line options.
+     */
+    public void showOptions() {
+        showOptionsHeader();
+
+        for (Option option : options) {
+            System.out.println(option.getInformation());
+        }
+    }
+
+    /**
+     * Parses the command line arguments.
+     */
+    public void parseArguments(String[] arguments) {
+        LinkedList<String> args = new LinkedList<>(Arrays.asList(arguments));
+
+        boolean valid = true;
+        while (!args.isEmpty()) {
+            String arg = args.removeFirst();
+
+            boolean handled = false;
+            for (Option option : options) {
+                if (option.processOption(arg, args)) {
+                    handled = true;
+                    break;
+                }
+            }
+            if (!handled) {
+                System.out.println("Unknown option: " + arg);
+                System.out.println();
+                valid = false;
+                break;
+            }
+        }
+        if (!valid) {
+            showOptions();
+            completed();
+        }
+    }
+
+    public void addOption(Option option) {
+        options.add(option);
+    }
+
+    /**
+     * Parses the command line arguments then runs the program.
+     */
+    public void run(String[] args) throws Exception {
+        parseArguments(args);
+        run();
+        LOG.info("MainSupport exiting code: {}", getExitCode());
+    }
+
+    /**
+     * Displays the header message for the command line options.
+     */
+    public void showOptionsHeader() {
+        System.out.println("Apache Camel Runner takes the following options");
+        System.out.println();
+    }
+
+
+    public abstract class ParameterOption extends Option {
+        private String parameterName;
+
+        protected ParameterOption(String abbreviation, String fullName, String description, String parameterName) {
+            super(abbreviation, fullName, description);
+            this.parameterName = parameterName;
+        }
+
+        @Override
+        protected void doProcess(String arg, LinkedList<String> remainingArgs) {
+            if (remainingArgs.isEmpty()) {
+                System.err.println("Expected fileName for ");
+                showOptions();
+                completed();
+            } else {
+                String parameter = remainingArgs.removeFirst();
+                doProcess(arg, parameter, remainingArgs);
+            }
+        }
+
+        @Override
+        public String getInformation() {
+            return "  " + getAbbreviation() + " or " + getFullName() + " <" + parameterName + "> = " + getDescription();
+        }
+
+        protected abstract void doProcess(String arg, String parameter, LinkedList<String> remainingArgs);
+    }
+}
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index c98ccff..8af3715 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -77,11 +77,10 @@ public abstract class MainSupport extends ServiceSupport {
     protected static final Logger LOG = LoggerFactory.getLogger(MainSupport.class);
     protected static final int UNINITIALIZED_EXIT_CODE = Integer.MIN_VALUE;
     protected static final int DEFAULT_EXIT_CODE = 0;
+    protected final AtomicInteger exitCode = new AtomicInteger(UNINITIALIZED_EXIT_CODE);
     protected final List<MainListener> listeners = new ArrayList<>();
-    protected final List<Option> options = new ArrayList<>();
-    protected final CountDownLatch latch = new CountDownLatch(1);
     protected final AtomicBoolean completed = new AtomicBoolean(false);
-    protected final AtomicInteger exitCode = new AtomicInteger(UNINITIALIZED_EXIT_CODE);
+    protected final CountDownLatch latch = new CountDownLatch(1);
 
     protected volatile CamelContext camelContext;
     protected volatile ProducerTemplate camelTemplate;
@@ -122,68 +121,6 @@ public abstract class MainSupport extends ServiceSupport {
     }
 
     protected MainSupport() {
-        addOption(new Option("h", "help", "Displays the help screen") {
-            protected void doProcess(String arg, LinkedList<String> remainingArgs) {
-                showOptions();
-                completed();
-            }
-        });
-        addOption(new ParameterOption("r", "routers",
-            "Sets the router builder classes which will be loaded while starting the camel context",
-            "routerBuilderClasses") {
-            @Override
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                setRouteBuilderClasses(parameter);
-            }
-        });
-        addOption(new ParameterOption("d", "duration",
-            "Sets the time duration (seconds) that the application will run for before terminating.",
-            "duration") {
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                // skip second marker to be backwards compatible
-                if (parameter.endsWith("s") || parameter.endsWith("S")) {
-                    parameter = parameter.substring(0, parameter.length() - 1);
-                }
-                configure().setDurationMaxSeconds(Integer.parseInt(parameter));
-            }
-        });
-        addOption(new ParameterOption("dm", "durationMaxMessages",
-            "Sets the duration of maximum number of messages that the application will process before terminating.",
-            "durationMaxMessages") {
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                configure().setDurationMaxMessages(Integer.parseInt(parameter));
-            }
-        });
-        addOption(new ParameterOption("di", "durationIdle",
-            "Sets the idle time duration (seconds) duration that the application can be idle before terminating.",
-            "durationIdle") {
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                // skip second marker to be backwards compatible
-                if (parameter.endsWith("s") || parameter.endsWith("S")) {
-                    parameter = parameter.substring(0, parameter.length() - 1);
-                }
-                configure().setDurationMaxIdleSeconds(Integer.parseInt(parameter));
-            }
-        });
-        addOption(new Option("t", "trace", "Enables tracing") {
-            protected void doProcess(String arg, LinkedList<String> remainingArgs) {
-                enableTrace();
-            }
-        });
-        addOption(new ParameterOption("e", "exitcode",
-            "Sets the exit code if duration was hit",
-            "exitcode") {
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                configure().setDurationHitExitCode(Integer.parseInt(parameter));
-            }
-        });
-        addOption(new ParameterOption("pl", "propertiesLocation",
-            "Sets location(s) to load properties, such as from classpath or file system.",
-            "propertiesLocation") {
-            protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
-                setPropertyPlaceholderLocations(parameter);
-            }
-        });
     }
 
     /**
@@ -317,51 +254,6 @@ public abstract class MainSupport extends ServiceSupport {
     }
 
     /**
-     * Displays the command line options.
-     */
-    public void showOptions() {
-        showOptionsHeader();
-
-        for (Option option : options) {
-            System.out.println(option.getInformation());
-        }
-    }
-
-    /**
-     * Parses the command line arguments.
-     */
-    public void parseArguments(String[] arguments) {
-        LinkedList<String> args = new LinkedList<>(Arrays.asList(arguments));
-
-        boolean valid = true;
-        while (!args.isEmpty()) {
-            String arg = args.removeFirst();
-
-            boolean handled = false;
-            for (Option option : options) {
-                if (option.processOption(arg, args)) {
-                    handled = true;
-                    break;
-                }
-            }
-            if (!handled) {
-                System.out.println("Unknown option: " + arg);
-                System.out.println();
-                valid = false;
-                break;
-            }
-        }
-        if (!valid) {
-            showOptions();
-            completed();
-        }
-    }
-
-    public void addOption(Option option) {
-        options.add(option);
-    }
-
-    /**
      * To configure options on Camel Main.
      */
     public MainConfigurationProperties configure() {
@@ -630,23 +522,6 @@ public abstract class MainSupport extends ServiceSupport {
         }
     }
 
-    /**
-     * Parses the command line arguments then runs the program.
-     */
-    public void run(String[] args) throws Exception {
-        parseArguments(args);
-        run();
-        LOG.info("MainSupport exiting code: {}", getExitCode());
-    }
-
-    /**
-     * Displays the header message for the command line options.
-     */
-    public void showOptionsHeader() {
-        System.out.println("Apache Camel Runner takes the following options");
-        System.out.println();
-    }
-
     public CamelContext getCamelContext() {
         return camelContext;
     }
@@ -1417,31 +1292,4 @@ public abstract class MainSupport extends ServiceSupport {
         protected abstract void doProcess(String arg, LinkedList<String> remainingArgs);
     }
 
-    public abstract class ParameterOption extends Option {
-        private String parameterName;
-
-        protected ParameterOption(String abbreviation, String fullName, String description, String parameterName) {
-            super(abbreviation, fullName, description);
-            this.parameterName = parameterName;
-        }
-
-        @Override
-        protected void doProcess(String arg, LinkedList<String> remainingArgs) {
-            if (remainingArgs.isEmpty()) {
-                System.err.println("Expected fileName for ");
-                showOptions();
-                completed();
-            } else {
-                String parameter = remainingArgs.removeFirst();
-                doProcess(arg, parameter, remainingArgs);
-            }
-        }
-
-        @Override
-        public String getInformation() {
-            return "  " + getAbbreviation() + " or " + getFullName() + " <" + parameterName + "> = " + getDescription();
-        }
-
-        protected abstract void doProcess(String arg, String parameter, LinkedList<String> remainingArgs);
-    }
 }
diff --git a/core/camel-main/src/test/java/org/apache/camel/main/MainSupportCommandLineTest.java b/core/camel-main/src/test/java/org/apache/camel/main/MainSupportCommandLineTest.java
index 78449e9..6d9c30f 100644
--- a/core/camel-main/src/test/java/org/apache/camel/main/MainSupportCommandLineTest.java
+++ b/core/camel-main/src/test/java/org/apache/camel/main/MainSupportCommandLineTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
 
 public class MainSupportCommandLineTest {
 
-    private class MyMainSupport extends MainSupport {
+    private class MyMainSupport extends MainCommandLineSupport {
 
         private CamelContext context = new DefaultCamelContext();