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 2022/06/04 19:12:29 UTC

[camel] branch main updated (be8a438cfc8 -> 3b33075f77b)

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

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


    from be8a438cfc8 CAMEL-17999: camel-bean - Allow to invoke clone method (also via simple language). Thanks to Steffen Brauns for unit test.
     new 5131a100a8c Removed unused
     new 3b33075f77b CAMEL-18166: camel-main - Make RoutesCollector more flexible for other runtimes to do custom strategy.

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:
 .../org/apache/camel/spi/RoutesBuilderLoader.java  |  5 ----
 .../apache/camel/main/DefaultRoutesCollector.java  | 30 +++++++++++++++++++---
 2 files changed, 27 insertions(+), 8 deletions(-)


[camel] 01/02: Removed unused

Posted by da...@apache.org.
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

commit 5131a100a8c4a9e4f54a2571b481e4a74ed92313
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jun 4 18:06:21 2022 +0200

    Removed unused
---
 .../src/main/java/org/apache/camel/spi/RoutesBuilderLoader.java      | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RoutesBuilderLoader.java b/core/camel-api/src/main/java/org/apache/camel/spi/RoutesBuilderLoader.java
index 1d702e22d33..6bb3bb7e201 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/RoutesBuilderLoader.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/RoutesBuilderLoader.java
@@ -30,11 +30,6 @@ public interface RoutesBuilderLoader extends StaticService, CamelContextAware {
      */
     String FACTORY_PATH = "META-INF/services/org/apache/camel/routes-loader/";
 
-    /**
-     * Service factory group.
-     */
-    String FACTORY_GROUP = "routes-loader";
-
     /**
      * The supported file extension.
      * <p/>


[camel] 02/02: CAMEL-18166: camel-main - Make RoutesCollector more flexible for other runtimes to do custom strategy.

Posted by da...@apache.org.
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

commit 3b33075f77b9bf16cd519e8477deb0fe8f51c25b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jun 4 21:12:17 2022 +0200

    CAMEL-18166: camel-main - Make RoutesCollector more flexible for other runtimes to do custom strategy.
---
 .../apache/camel/main/DefaultRoutesCollector.java  | 30 +++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
index e1d1c4a3b52..3462c8792cc 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
@@ -21,7 +21,6 @@ import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExtendedCamelContext;
@@ -53,7 +52,13 @@ public class DefaultRoutesCollector implements RoutesCollector {
         final List<RoutesBuilder> routes = new ArrayList<>();
         final AntPathMatcher matcher = new AntPathMatcher();
 
-        Set<LambdaRouteBuilder> lrbs = camelContext.getRegistry().findByType(LambdaRouteBuilder.class);
+        Collection<RoutesBuilder> additional
+                = collectAdditionalRoutesFromRegistry(camelContext, excludePattern, includePattern);
+        if (additional != null) {
+            routes.addAll(additional);
+        }
+
+        Collection<LambdaRouteBuilder> lrbs = findByType(camelContext, LambdaRouteBuilder.class);
         for (LambdaRouteBuilder lrb : lrbs) {
             RouteBuilder rb = new RouteBuilder() {
                 @Override
@@ -64,7 +69,7 @@ public class DefaultRoutesCollector implements RoutesCollector {
             routes.add(rb);
         }
 
-        Set<RoutesBuilder> builders = camelContext.getRegistry().findByType(RoutesBuilder.class);
+        Collection<RoutesBuilder> builders = findByType(camelContext, RoutesBuilder.class);
         for (RoutesBuilder routesBuilder : builders) {
             // filter out abstract classes
             boolean abs = Modifier.isAbstract(routesBuilder.getClass().getModifiers());
@@ -195,4 +200,23 @@ public class DefaultRoutesCollector implements RoutesCollector {
 
         return accepted;
     }
+
+    /**
+     * Strategy to allow collecting additional routes from registry.
+     */
+    protected Collection<RoutesBuilder> collectAdditionalRoutesFromRegistry(
+            CamelContext camelContext,
+            String excludePattern,
+            String includePattern) {
+        return null;
+    }
+
+    /**
+     * Strategy to discover a specific route builder type from the registry. This allows Spring Boot or other runtimes
+     * to do custom lookup.
+     */
+    protected <T> Collection<T> findByType(CamelContext camelContext, Class<T> type) {
+        return camelContext.getRegistry().findByType(type);
+    }
+
 }