This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch route-collector in repository https://gitbox.apache.org/repos/asf/camel.git
commit dba0c7ff4c670986ea31f73e42abec6f85170e76 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Oct 17 15:12:41 2019 +0200 CAMEL-14050: camel-main - Add logic for automatic RouteBuilder class detection ala camel-spring-boot has --- .../spring/boot/CamelConfigurationProperties.java | 63 +++++------- .../camel/main/DefaultConfigurationProperties.java | 107 +++++++++++++++------ .../camel-main-configuration-metadata.json | 14 +++ 3 files changed, 114 insertions(+), 70 deletions(-) diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java index 3018a8d..8e06364 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java @@ -47,30 +47,6 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties */ private boolean warnOnEarlyShutdown = true; - /** - * Directory to scan for adding additional XML routes. - * You can turn this off by setting the value to false. - * - * Files can be loaded from either classpath or file by prefixing with classpath: or file: - * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml - * - * Multiple directories can be specified and separated by comma, such as: - * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml - */ - private String xmlRoutes = "classpath:camel/*.xml"; - - /** - * Directory to scan for adding additional XML rests. - * You can turn this off by setting the value to false. - * - * Files can be loaded from either classpath or file by prefixing with classpath: or file: - * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml - * - * Multiple directories can be specified and separated by comma, such as: - * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml - */ - private String xmlRests = "classpath:camel-rest/*.xml"; - // Default Properties via camel-main // --------------------------------- @@ -457,6 +433,30 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties */ private String javaRoutesExcludePattern; + /** + * Directory to scan for adding additional XML routes. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + private String xmlRoutes = "classpath:camel/*.xml"; + + /** + * Directory to scan for adding additional XML rests. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + private String xmlRests = "classpath:camel-rest/*.xml"; + // Getters & setters // ----------------- @@ -484,19 +484,4 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties this.warnOnEarlyShutdown = warnOnEarlyShutdown; } - public String getXmlRoutes() { - return xmlRoutes; - } - - public void setXmlRoutes(String xmlRoutes) { - this.xmlRoutes = xmlRoutes; - } - - public String getXmlRests() { - return xmlRests; - } - - public void setXmlRests(String xmlRests) { - this.xmlRests = xmlRests; - } } diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java index fdd1c66..e8794c5 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java @@ -71,31 +71,10 @@ public abstract class DefaultConfigurationProperties<T> { private String routeFilterExcludePattern; private boolean beanIntrospectionExtendedStatistics; private LoggingLevel beanIntrospectionLoggingLevel; - /** - * Used for inclusive filtering component scanning of RouteBuilder classes with @Component annotation. - * The exclusive filtering takes precedence over inclusive filtering. - * The pattern is using Ant-path style pattern. - * - * Multiple patterns can be specified separated by comma. - * For example to include all classes starting with Foo use: **/Foo* - * To include all routes form a specific package use: com/mycompany/foo/* - * To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** - * And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/* - */ private String javaRoutesIncludePattern; - - /** - * Used for exclusive filtering component scanning of RouteBuilder classes with @Component annotation. - * The exclusive filtering takes precedence over inclusive filtering. - * The pattern is using Ant-path style pattern. - * Multiple patterns can be specified separated by comma. - * - * For example to exclude all classes starting with Bar use: **/Bar* - * To exclude all routes form a specific package use: com/mycompany/bar/* - * To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** - * And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/* - */ private String javaRoutesExcludePattern; + private String xmlRoutes = "classpath:camel/*.xml"; + private String xmlRests = "classpath:camel-rest/*.xml"; // getter and setters // -------------------------------------------------------------- @@ -767,6 +746,42 @@ public abstract class DefaultConfigurationProperties<T> { this.javaRoutesExcludePattern = javaRoutesExcludePattern; } + public String getXmlRoutes() { + return xmlRoutes; + } + + /** + * Directory to scan for adding additional XML routes. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + public void setXmlRoutes(String xmlRoutes) { + this.xmlRoutes = xmlRoutes; + } + + public String getXmlRests() { + return xmlRests; + } + + /** + * Directory to scan for adding additional XML rests. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + public void setXmlRests(String xmlRests) { + this.xmlRests = xmlRests; + } + // fluent builders // -------------------------------------------------------------- @@ -1237,9 +1252,9 @@ public abstract class DefaultConfigurationProperties<T> { * The pattern matches by node and route id's * Multiple patterns can be separated by comma. */ - public DefaultConfigurationProperties withTracingPattern(String tracingPattern) { + public T withTracingPattern(String tracingPattern) { this.tracingPattern = tracingPattern; - return this; + return (T) this; } /** @@ -1256,9 +1271,9 @@ public abstract class DefaultConfigurationProperties<T> { * 3. regular expression match, returns true * 4. otherwise returns false */ - public DefaultConfigurationProperties withMdcLoggingKeysPattern(String mdcLoggingKeysPattern) { + public T withMdcLoggingKeysPattern(String mdcLoggingKeysPattern) { this.mdcLoggingKeysPattern = mdcLoggingKeysPattern; - return this; + return (T) this; } /** @@ -1272,9 +1287,9 @@ public abstract class DefaultConfigurationProperties<T> { * To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** * And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/* */ - public DefaultConfigurationProperties withJavaRoutesIncludePattern(String javaRoutesIncludePattern) { + public T withJavaRoutesIncludePattern(String javaRoutesIncludePattern) { this.javaRoutesIncludePattern = javaRoutesIncludePattern; - return this; + return (T) this; } /** @@ -1288,8 +1303,38 @@ public abstract class DefaultConfigurationProperties<T> { * To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** * And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/* */ - public DefaultConfigurationProperties withJavaRoutesExcludePattern(String javaRoutesExcludePattern) { + public T withJavaRoutesExcludePattern(String javaRoutesExcludePattern) { this.javaRoutesExcludePattern = javaRoutesExcludePattern; - return this; + return (T) this; + } + + /** + * Directory to scan for adding additional XML routes. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + public T withXmlRoutes(String xmlRoutes) { + this.xmlRoutes = xmlRoutes; + return (T) this; + } + + /** + * Directory to scan for adding additional XML rests. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + public T withXmlRests(String xmlRests) { + this.xmlRests = xmlRests; + return (T) this; } } diff --git a/core/camel-main/src/main/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/main/resources/META-INF/camel-main-configuration-metadata.json index d0f9a75..e0c3bfe 100644 --- a/core/camel-main/src/main/resources/META-INF/camel-main-configuration-metadata.json +++ b/core/camel-main/src/main/resources/META-INF/camel-main-configuration-metadata.json @@ -380,6 +380,20 @@ "description":"To turn on MDC logging" }, { + "name":"camel.main.xml-rests", + "type":"java.lang.String", + "sourceType":"org.apache.camel.main.DefaultConfigurationProperties", + "description":"Directory to scan for adding additional XML rests. You can turn this off by setting the value to false. Files can be loaded from either classpath or file by prefixing with classpath: or file: Wildcards is supported using a ANT pattern style paths, such as classpath:**\/*camel*.xml Multiple directories can be specified and separated by comma, such as: file:\/myapp\/mycamel\/*.xml,file:\/myapp\/myothercamel\/*.xml", + "defaultValue":"classpath:camel-rest\/*.xml" + }, + { + "name":"camel.main.xml-routes", + "type":"java.lang.String", + "sourceType":"org.apache.camel.main.DefaultConfigurationProperties", + "description":"Directory to scan for adding additional XML routes. You can turn this off by setting the value to false. Files can be loaded from either classpath or file by prefixing with classpath: or file: Wildcards is supported using a ANT pattern style paths, such as classpath:**\/*camel*.xml Multiple directories can be specified and separated by comma, such as: file:\/myapp\/mycamel\/*.xml,file:\/myapp\/myothercamel\/*.xml", + "defaultValue":"classpath:camel\/*.xml" + }, + { "name":"camel.hystrix.allow-maximum-size-to-diverge-from-core-size", "type":"java.lang.Boolean", "sourceType":"org.apache.camel.main.HystrixConfigurationProperties",