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
The following commit(s) were added to refs/heads/master by this push: new 2a51987 CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files. 2a51987 is described below commit 2a51987e43443e981409240ec3ac2affd3059e4c Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Jun 20 11:28:21 2019 +0200 CAMEL-13663: camel-main-maven-plugin to generte spring-boot tooling metadata to fool Java editors to have code completions for Camel Main application.properties files. --- .../apache/camel/maven/SpringBootToolingMojo.java | 29 +- .../java/org/apache/camel/util/StringHelper.java | 28 ++ .../org/apache/camel/util/StringHelperTest.java | 46 ++ .../META-INF/spring-configuration-metadata.json | 462 ++++++++++----------- .../maven/camel-main-package-maven-plugin/pom.xml | 4 + .../apache/camel/maven/PrepareCamelMainMojo.java | 27 +- 6 files changed, 314 insertions(+), 282 deletions(-) diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/SpringBootToolingMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/SpringBootToolingMojo.java index f686df6..a5d8cb0 100644 --- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/SpringBootToolingMojo.java +++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/SpringBootToolingMojo.java @@ -33,6 +33,8 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; +import static org.apache.camel.util.StringHelper.camelCaseToDash; + /** * Pre scans your project and builds spring boot tooling metafiles which fools tools to * offer code completion for editing properties files. @@ -131,32 +133,7 @@ public class SpringBootToolingMojo extends AbstractMainMojo { } } } - - private static String camelCaseToDash(String name) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < name.length(); i++) { - char ch = name.charAt(i); - if (Character.isUpperCase(ch)) { - sb.append("-"); - sb.append(Character.toLowerCase(ch)); - } else { - sb.append(ch); - } - } - - // somme words we dont want ID -> i-d, but keep it as id - String answer = sb.toString(); - answer = answer.replaceAll("-i-d-", "-id-"); - answer = answer.replaceAll("-u-r-i-", "-uri-"); - answer = answer.replaceAll("-u-r-l-", "-url-"); - answer = answer.replaceAll("-j-m-s-", "-jms-"); - answer = answer.replaceAll("-j-m-x-", "-jmx-"); - answer = answer.replaceFirst("-i-d$", "-id"); - answer = answer.replaceFirst("-u-r-i$", "-uri"); - answer = answer.replaceFirst("-u-r-l$", "-url"); - return answer; - } - + private static String springBootJavaType(String javaType) { if ("boolean".equalsIgnoreCase(javaType)) { return "java.lang.Boolean"; diff --git a/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java b/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java index ccddc61..5bf714c 100644 --- a/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java +++ b/core/camel-util/src/main/java/org/apache/camel/util/StringHelper.java @@ -822,4 +822,32 @@ public final class StringHelper { return m.matches(); } + public static String camelCaseToDash(String text) { + StringBuilder answer = new StringBuilder(); + + Character prev = null; + Character next = null; + char[] arr = text.toCharArray(); + for (int i = 0; i < arr.length; i++) { + char ch = arr[i]; + if (i < arr.length - 1) { + next = arr[i + 1]; + } else { + next = null; + } + if (ch == '-' || ch == '_') { + answer.append("-"); + } else if (Character.isUpperCase(ch) && prev != null && !Character.isUpperCase(prev)) { + answer.append("-").append(ch); + } else if (Character.isUpperCase(ch) && prev != null && next != null && Character.isLowerCase(next)) { + answer.append("-").append(ch); + } else { + answer.append(ch); + } + prev = ch; + } + + return answer.toString().toLowerCase(Locale.US); + } + } diff --git a/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java b/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java new file mode 100644 index 0000000..a48a3bf --- /dev/null +++ b/core/camel-util/src/test/java/org/apache/camel/util/StringHelperTest.java @@ -0,0 +1,46 @@ +/* + * 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.util; + +import junit.framework.TestCase; +import org.junit.Test; + +import static org.apache.camel.util.StringHelper.camelCaseToDash; + +public class StringHelperTest extends TestCase { + + @Test + public void testCamelCashToDash() throws Exception { + assertEquals("hello-world", camelCaseToDash("HelloWorld")); + assertEquals("hello-big-world", camelCaseToDash("HelloBigWorld")); + assertEquals("hello-big-world", camelCaseToDash("Hello-bigWorld")); + assertEquals("my-id", camelCaseToDash("MyId")); + assertEquals("my-id", camelCaseToDash("MyID")); + assertEquals("my-url", camelCaseToDash("MyUrl")); + assertEquals("my-url", camelCaseToDash("MyURL")); + assertEquals("my-big-id", camelCaseToDash("MyBigId")); + assertEquals("my-big-id", camelCaseToDash("MyBigID")); + assertEquals("my-big-url", camelCaseToDash("MyBigUrl")); + assertEquals("my-big-url", camelCaseToDash("MyBigURL")); + assertEquals("my-big-id-again", camelCaseToDash("MyBigIdAgain")); + assertEquals("my-big-id-again", camelCaseToDash("MyBigIDAgain")); + assertEquals("my-big-url-again", camelCaseToDash("MyBigUrlAgain")); + assertEquals("my-big-url-again", camelCaseToDash("MyBigURLAgain")); + + assertEquals("use-mdc-logging", camelCaseToDash("UseMDCLogging")); + } +} diff --git a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json index 4f3190e..03f8ff8 100644 --- a/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json +++ b/examples/camel-example-main-artemis/src/main/resources/META-INF/spring-configuration-metadata.json @@ -1,422 +1,422 @@ { "properties": [ { - "name": "camel.main.name", - "type": "java.lang.String", - "description": "Sets the name of the CamelContext." - }, - { - "name": "camel.main.duration-max-seconds", - "type": "java.lang.Integer", - "description": "To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM. You can use this to run Camel for a short while." - }, - { - "name": "camel.main.duration-max-idle-seconds", - "type": "java.lang.Integer", - "description": "To specify for how long time in seconds Camel can be idle before automatic terminating the JVM. You can use this to run Camel for a short while." - }, - { - "name": "camel.main.duration-max-messages", - "type": "java.lang.Integer", - "description": "To specify how many messages to process by Camel before automatic terminating the JVM. You can use this to run Camel for a short while." + "name": "camel.main.allow-use-original-message", + "type": "java.lang.Boolean", + "description": "Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false." }, { - "name": "camel.main.shutdown-timeout", - "type": "java.lang.Integer", - "description": "Timeout in seconds to graceful shutdown Camel.", - "defaultValue": 300 + "name": "camel.main.auto-configuration-enabled", + "type": "java.lang.Boolean", + "description": "Whether auto configuration of components/dataformats/languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF/services/org/apache/camel/autowire.properties. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=valu [...] + "defaultValue": true }, { - "name": "camel.main.shutdown-suppress-logging-on-timeout", + "name": "camel.main.auto-startup", "type": "java.lang.Boolean", - "description": "Whether Camel should try to suppress logging during shutdown and timeout was triggered, meaning forced shutdown is happening. And during forced shutdown we want to avoid logging errors/warnings et all in the logs as a side-effect of the forced timeout. Notice the suppress is a best effort as there may still be some logs coming from 3rd party libraries and whatnot, which Camel cannot control. This option is default false." + "description": "Sets whether the object should automatically start when Camel starts. Important: Currently only routes can be disabled, as CamelContext's are always started. Note: When setting auto startup false on CamelContext then that takes precedence and no routes is started. You would need to start CamelContext explicit using the org.apache.camel.CamelContext.start() method, to start the context, and then you would need to start the routes manually using CamelContext.getRouteC [...] + "defaultValue": true }, { - "name": "camel.main.shutdown-now-on-timeout", + "name": "camel.main.autowire-component-properties", "type": "java.lang.Boolean", - "description": "Sets whether to force shutdown of all consumers when a timeout occurred and thus not all consumers was shutdown within that period. You should have good reasons to set this option to false as it means that the routes keep running and is halted abruptly when CamelContext has been shutdown.", + "description": "Whether autowiring components with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. <p/> This option is default enabled.", "defaultValue": true }, { - "name": "camel.main.shutdown-routes-in-reverse-order", + "name": "camel.main.autowire-component-properties-allow-private-setter", "type": "java.lang.Boolean", - "description": "Sets whether routes should be shutdown in reverse or the same order as they where started.", + "description": "Whether autowiring components allows to use private setter method when setting the value. This may be needed in some rare situations when some configuration classes may configure via constructors over setters. But constructor configuration is more cumbersome to use via .properties files etc.", "defaultValue": true }, { - "name": "camel.main.shutdown-log-inflight-exchanges-on-timeout", + "name": "camel.main.autowire-component-properties-deep", "type": "java.lang.Boolean", - "description": "Sets whether to log information about the inflight Exchanges which are still running during a shutdown which didn't complete without the given timeout.", - "defaultValue": true + "description": "Whether autowiring components (with deep nesting by attempting to walk as deep down the object graph by creating new empty objects on the way if needed) with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. <p/> This option is default disabled." }, { - "name": "camel.main.file-configurations", - "type": "java.lang.String", - "description": "Directory to load additional configuration files that contains configuration values that takes precedence over any other configuration. This can be used to refer to files that may have secret configuration that has been mounted on the file system for containers. You can specify a pattern to load from sub directories and a name pattern such as /var/app/secret/*.properties, multiple directories can be separated by comma." + "name": "camel.main.consumer-template-cache-size", + "type": "java.lang.Integer", + "description": "Consumer template endpoints cache size.", + "defaultValue": 1000 }, { - "name": "camel.main.jmx-enabled", - "type": "java.lang.Boolean", - "description": "Enable JMX in your Camel application.", - "defaultValue": true + "name": "camel.main.duration", + "type": "java.lang.Long", + "description": "Sets the duration (in seconds) to run the application until it should be terminated. Defaults to -1. Any value <= 0 will run forever.", + "defaultValue": -1 }, { - "name": "camel.main.producer-template-cache-size", + "name": "camel.main.duration-hit-exit-code", "type": "java.lang.Integer", - "description": "Producer template endpoints cache size.", - "defaultValue": 1000 + "description": "Sets the exit code for the application if duration was hit" }, { - "name": "camel.main.consumer-template-cache-size", + "name": "camel.main.duration-max-idle-seconds", "type": "java.lang.Integer", - "description": "Consumer template endpoints cache size.", - "defaultValue": 1000 + "description": "To specify for how long time in seconds Camel can be idle before automatic terminating the JVM. You can use this to run Camel for a short while." }, { - "name": "camel.main.load-type-converters", - "type": "java.lang.Boolean", - "description": "Whether to load custom type converters by scanning classpath. This is used for backwards compatibility with Camel 2.x. Its recommended to migrate to use fast type converter loading by setting <tt>@Converter(loader = true)</tt> on your custom type converter classes.", - "defaultValue": true + "name": "camel.main.duration-max-messages", + "type": "java.lang.Integer", + "description": "To specify how many messages to process by Camel before automatic terminating the JVM. You can use this to run Camel for a short while." }, { - "name": "camel.main.log-debug-max-chars", + "name": "camel.main.duration-max-seconds", "type": "java.lang.Integer", - "description": "Is used to limit the maximum length of the logging Camel message bodies. If the message body is longer than the limit, the log message is clipped. Use -1 to have unlimited length. Use for example 1000 to log at most 1000 characters." + "description": "To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM. You can use this to run Camel for a short while." }, { - "name": "camel.main.stream-caching-enabled", + "name": "camel.main.endpoint-runtime-statistics-enabled", "type": "java.lang.Boolean", - "description": "Sets whether stream caching is enabled or not. Default is false." + "description": "Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). The default value is false." }, { - "name": "camel.main.stream-caching-spool-directory", + "name": "camel.main.file-configurations", "type": "java.lang.String", - "description": "Sets the stream caching spool (temporary) directory to use for overflow and spooling to disk. If no spool directory has been explicit configured, then a temporary directory is created in the java.io.tmpdir directory." + "description": "Directory to load additional configuration files that contains configuration values that takes precedence over any other configuration. This can be used to refer to files that may have secret configuration that has been mounted on the file system for containers. You can specify a pattern to load from sub directories and a name pattern such as /var/app/secret/*.properties, multiple directories can be separated by comma." }, { - "name": "camel.main.stream-caching-spool-cipher", - "type": "java.lang.String", - "description": "Sets a stream caching cipher name to use when spooling to disk to write with encryption. By default the data is not encrypted." + "name": "camel.main.handle-fault", + "type": "java.lang.Boolean", + "description": "Sets whether fault handling is enabled or not. Default is false." }, { - "name": "camel.main.stream-caching-spool-threshold", - "type": "java.lang.Long", - "description": "Stream caching threshold in bytes when overflow to disk is activated. The default threshold is 128kb. Use -1 to disable overflow to disk." + "name": "camel.main.hangup-interceptor-enabled", + "type": "java.lang.Boolean", + "description": "Whether to use graceful hangup when Camel is stopping or when the JVM terminates.", + "defaultValue": true }, { - "name": "camel.main.stream-caching-spool-used-heap-memory-threshold", + "name": "camel.main.hystrix.allow-maximum-size-to-diverge-from-core-size", + "type": "java.lang.Boolean", + "description": "Allows the configuration for maximumSize to take effect. That value can then be equal to, or higher, than coreSize" + }, + { + "name": "camel.main.hystrix.circuit-breaker-enabled", + "type": "java.lang.Boolean", + "description": "Whether to use a HystrixCircuitBreaker or not. If false no circuit-breaker logic will be used and all requests permitted. <p> This is similar in effect to circuitBreakerForceClosed() except that continues tracking metrics and knowing whether it should be open/closed, this property results in not even instantiating a circuit-breaker." + }, + { + "name": "camel.main.hystrix.circuit-breaker-error-threshold-percentage", "type": "java.lang.Integer", - "description": "Sets a percentage (1-99) of used heap memory threshold to activate stream caching spooling to disk." + "description": "Error percentage threshold (as whole number such as 50) at which point the circuit breaker will trip open and reject requests. <p> It will stay tripped for the duration defined in circuitBreakerSleepWindowInMilliseconds; <p> The error percentage this is compared against comes from HystrixCommandMetrics.getHealthCounts()." }, { - "name": "camel.main.stream-caching-spool-used-heap-memory-limit", - "type": "java.lang.String", - "description": "Sets what the upper bounds should be when streamCachingSpoolUsedHeapMemoryThreshold is in use." + "name": "camel.main.hystrix.circuit-breaker-force-closed", + "type": "java.lang.Boolean", + "description": "If true the HystrixCircuitBreaker#allowRequest() will always return true to allow requests regardless of the error percentage from HystrixCommandMetrics.getHealthCounts(). <p> The circuitBreakerForceOpen() property takes precedence so if it set to true this property does nothing." }, { - "name": "camel.main.stream-caching-any-spool-rules", + "name": "camel.main.hystrix.circuit-breaker-force-open", "type": "java.lang.Boolean", - "description": "Sets whether if just any of the org.apache.camel.spi.StreamCachingStrategy.SpoolRule rules returns true then shouldSpoolCache(long) returns true, to allow spooling to disk. If this option is false, then all the org.apache.camel.spi.StreamCachingStrategy.SpoolRule must return true. The default value is false which means that all the rules must return true." + "description": "If true the HystrixCircuitBreaker.allowRequest() will always return false, causing the circuit to be open (tripped) and reject all requests. <p> This property takes precedence over circuitBreakerForceClosed();" }, { - "name": "camel.main.stream-caching-buffer-size", + "name": "camel.main.hystrix.circuit-breaker-request-volume-threshold", "type": "java.lang.Integer", - "description": "Sets the stream caching buffer size to use when allocating in-memory buffers used for in-memory stream caches. The default size is 4096." + "description": "Minimum number of requests in the metricsRollingStatisticalWindowInMilliseconds() that must exist before the HystrixCircuitBreaker will trip. <p> If below this number the circuit will not trip regardless of error percentage." }, { - "name": "camel.main.stream-caching-remove-spool-directory-when-stopping", - "type": "java.lang.Boolean", - "description": "Whether to remove stream caching temporary directory when stopping. This option is default true.", - "defaultValue": true + "name": "camel.main.hystrix.circuit-breaker-sleep-window-in-milliseconds", + "type": "java.lang.Integer", + "description": "The time in milliseconds after a HystrixCircuitBreaker trips open that it should wait before trying requests again." }, { - "name": "camel.main.stream-caching-statistics-enabled", - "type": "java.lang.Boolean", - "description": "Sets whether stream caching statistics is enabled." + "name": "camel.main.hystrix.core-pool-size", + "type": "java.lang.Integer", + "description": "Core thread-pool size that gets passed to {@link java.util.concurrent.ThreadPoolExecutor#setCorePoolSize(int)}" }, { - "name": "camel.main.tracing", - "type": "java.lang.Boolean", - "description": "Sets whether tracing is enabled or not. Default is false." + "name": "camel.main.hystrix.execution-isolation-semaphore-max-concurrent-requests", + "type": "java.lang.Integer", + "description": "Number of concurrent requests permitted to HystrixCommand.run(). Requests beyond the concurrent limit will be rejected. <p> Applicable only when executionIsolationStrategy == SEMAPHORE." }, { - "name": "camel.main.message-history", - "type": "java.lang.Boolean", - "description": "Sets whether message history is enabled or not. Default is true.", - "defaultValue": true + "name": "camel.main.hystrix.execution-isolation-strategy", + "type": "java.lang.String", + "description": "What isolation strategy HystrixCommand.run() will be executed with. <p> If THREAD then it will be executed on a separate thread and concurrent requests limited by the number of threads in the thread-pool. <p> If SEMAPHORE then it will be executed on the calling thread and concurrent requests limited by the semaphore count." }, { - "name": "camel.main.log-mask", + "name": "camel.main.hystrix.execution-isolation-thread-interrupt-on-timeout", "type": "java.lang.Boolean", - "description": "Sets whether log mask is enabled or not. Default is false." + "description": "Whether the execution thread should attempt an interrupt (using {@link Future#cancel} ) when a thread times out. <p> Applicable only when executionIsolationStrategy() == THREAD." }, { - "name": "camel.main.log-exhausted-message-body", + "name": "camel.main.hystrix.execution-timeout-enabled", "type": "java.lang.Boolean", - "description": "Sets whether to log exhausted message body with message history. Default is false." + "description": "Whether the timeout mechanism is enabled for this command" }, { - "name": "camel.main.handle-fault", - "type": "java.lang.Boolean", - "description": "Sets whether fault handling is enabled or not. Default is false." + "name": "camel.main.hystrix.execution-timeout-in-milliseconds", + "type": "java.lang.Integer", + "description": "Time in milliseconds at which point the command will timeout and halt execution. <p> If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted. If the command is semaphore-isolated and a HystrixObservableCommand, that command will get unsubscribed." }, { - "name": "camel.main.auto-startup", + "name": "camel.main.hystrix.fallback-enabled", "type": "java.lang.Boolean", - "description": "Sets whether the object should automatically start when Camel starts. Important: Currently only routes can be disabled, as CamelContext's are always started. Note: When setting auto startup false on CamelContext then that takes precedence and no routes is started. You would need to start CamelContext explicit using the org.apache.camel.CamelContext.start() method, to start the context, and then you would need to start the routes manually using CamelContext.getRouteC [...] - "defaultValue": true + "description": "Whether HystrixCommand.getFallback() should be attempted when failure occurs." }, { - "name": "camel.main.allow-use-original-message", - "type": "java.lang.Boolean", - "description": "Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false." + "name": "camel.main.hystrix.fallback-isolation-semaphore-max-concurrent-requests", + "type": "java.lang.Integer", + "description": "Number of concurrent requests permitted to HystrixCommand.getFallback(). Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback." }, { - "name": "camel.main.endpoint-runtime-statistics-enabled", - "type": "java.lang.Boolean", - "description": "Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). The default value is false." + "name": "camel.main.hystrix.group-key", + "type": "java.lang.String", + "description": "Sets the group key to use. The default value is CamelHystrix." }, { - "name": "camel.main.use-data-type", - "type": "java.lang.Boolean", - "description": "Whether to enable using data type on Camel messages. Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. Otherwise data type is default off." + "name": "camel.main.hystrix.keep-alive-time", + "type": "java.lang.Integer", + "description": "Keep-alive time in minutes that gets passed to {@link ThreadPoolExecutor#setKeepAliveTime(long,TimeUnit)}" }, { - "name": "camel.main.use-breadcrumb", - "type": "java.lang.Boolean", - "description": "Set whether breadcrumb is enabled. The default value is false." + "name": "camel.main.hystrix.maximum-size", + "type": "java.lang.Integer", + "description": "Maximum thread-pool size that gets passed to {@link ThreadPoolExecutor#setMaximumPoolSize(int)} . This is the maximum amount of concurrency that can be supported without starting to reject HystrixCommands. Please note that this setting only takes effect if you also set allowMaximumSizeToDivergeFromCoreSize" }, { - "name": "camel.main.jmx-management-statistics-level", - "type": "org.apache.camel.ManagementStatisticsLevel", - "description": "Sets the JMX statistics level The level can be set to Extended to gather additional information The default value is Default.", - "defaultValue": "ManagementStatisticsLevel.Default" + "name": "camel.main.hystrix.max-queue-size", + "type": "java.lang.Integer", + "description": "Max queue size that gets passed to {@link BlockingQueue} in HystrixConcurrencyStrategy.getBlockingQueue(int) This should only affect the instantiation of a threadpool - it is not eliglible to change a queue size on the fly. For that, use queueSizeRejectionThreshold()." }, { - "name": "camel.main.jmx-management-name-pattern", - "type": "java.lang.String", - "description": "The naming pattern for creating the CamelContext JMX management name. The default pattern is #name#", - "defaultValue": "#name#" + "name": "camel.main.hystrix.metrics-health-snapshot-interval-in-milliseconds", + "type": "java.lang.Integer", + "description": "Time in milliseconds to wait between allowing health snapshots to be taken that calculate success and error percentages and affect HystrixCircuitBreaker.isOpen() status. <p> On high-volume circuits the continual calculation of error percentage can become CPU intensive thus this controls how often it is calculated." }, { - "name": "camel.main.jmx-create-connector", - "type": "java.lang.Boolean", - "description": "Whether JMX connector is created, allowing clients to connect remotely The default value is false." + "name": "camel.main.hystrix.metrics-rolling-percentile-bucket-size", + "type": "java.lang.Integer", + "description": "Maximum number of values stored in each bucket of the rolling percentile. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." }, { - "name": "camel.main.use-mdc-logging", + "name": "camel.main.hystrix.metrics-rolling-percentile-enabled", "type": "java.lang.Boolean", - "description": "To turn on MDC logging" + "description": "Whether percentile metrics should be captured using HystrixRollingPercentile inside HystrixCommandMetrics." }, { - "name": "camel.main.thread-name-pattern", - "type": "java.lang.String", - "description": "Sets the thread name pattern used for creating the full thread name. The default pattern is: Camel (#camelId#) thread ##counter# - #name# Where #camelId# is the name of the CamelContext. and #counter# is a unique incrementing counter. and #name# is the regular thread name. You can also use #longName# which is the long thread name which can includes endpoint parameters etc." + "name": "camel.main.hystrix.metrics-rolling-percentile-window-buckets", + "type": "java.lang.Integer", + "description": "Number of buckets the rolling percentile window is broken into. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." }, { - "name": "camel.main.route-filter-include-pattern", - "type": "java.lang.String", - "description": "Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by {@link PatternHelper#matchPattern(String,String)} . For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* [...] + "name": "camel.main.hystrix.metrics-rolling-percentile-window-in-milliseconds", + "type": "java.lang.Integer", + "description": "Duration of percentile rolling window in milliseconds. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." }, { - "name": "camel.main.route-filter-exclude-pattern", - "type": "java.lang.String", - "description": "Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by {@link PatternHelper#matchPattern(String,String)} . For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* [...] + "name": "camel.main.hystrix.metrics-rolling-statistical-window-buckets", + "type": "java.lang.Integer", + "description": "Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside HystrixCommandMetrics." }, { - "name": "camel.main.auto-configuration-enabled", - "type": "java.lang.Boolean", - "description": "Whether auto configuration of components/dataformats/languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF/services/org/apache/camel/autowire.properties. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=valu [...] - "defaultValue": true + "name": "camel.main.hystrix.metrics-rolling-statistical-window-in-milliseconds", + "type": "java.lang.Integer", + "description": "This property sets the duration of the statistical rolling window, in milliseconds. This is how long metrics are kept for the thread pool. The window is divided into buckets and “rolls” by those increments." }, { - "name": "camel.main.autowire-component-properties", - "type": "java.lang.Boolean", - "description": "Whether autowiring components with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. <p/> This option is default enabled.", - "defaultValue": true + "name": "camel.main.hystrix.queue-size-rejection-threshold", + "type": "java.lang.Integer", + "description": "Queue size rejection threshold is an artificial max size at which rejections will occur even if {@link #maxQueueSize} has not been reached. This is done because the {@link #maxQueueSize} of a {@link BlockingQueue} can not be dynamically changed and we want to support dynamically changing the queue size that affects rejections. <p> This is used by HystrixCommand when queuing a thread for execution." }, { - "name": "camel.main.autowire-component-properties-deep", + "name": "camel.main.hystrix.request-log-enabled", "type": "java.lang.Boolean", - "description": "Whether autowiring components (with deep nesting by attempting to walk as deep down the object graph by creating new empty objects on the way if needed) with properties that are of same type, which has been added to the Camel registry, as a singleton instance. This is used for convention over configuration to inject DataSource, AmazonLogin instances to the components. <p/> This option is default disabled." + "description": "Whether HystrixCommand execution and events should be logged to HystrixRequestLog." }, { - "name": "camel.main.autowire-component-properties-allow-private-setter", - "type": "java.lang.Boolean", - "description": "Whether autowiring components allows to use private setter method when setting the value. This may be needed in some rare situations when some configuration classes may configure via constructors over setters. But constructor configuration is more cumbersome to use via .properties files etc.", - "defaultValue": true + "name": "camel.main.hystrix.thread-pool-key", + "type": "java.lang.String", + "description": "Sets the thread pool key to use. Will by default use the same value as groupKey has been configured to use." }, { - "name": "camel.main.duration", - "type": "java.lang.Long", - "description": "Sets the duration (in seconds) to run the application until it should be terminated. Defaults to -1. Any value <= 0 will run forever.", - "defaultValue": -1 + "name": "camel.main.hystrix.thread-pool-rolling-number-statistical-window-buckets", + "type": "java.lang.Integer", + "description": "Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance." }, { - "name": "camel.main.duration-hit-exit-code", + "name": "camel.main.hystrix.thread-pool-rolling-number-statistical-window-in-milliseconds", "type": "java.lang.Integer", - "description": "Sets the exit code for the application if duration was hit" + "description": "Duration of statistical rolling window in milliseconds. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance." }, { - "name": "camel.main.hangup-interceptor-enabled", + "name": "camel.main.jmx-create-connector", "type": "java.lang.Boolean", - "description": "Whether to use graceful hangup when Camel is stopping or when the JVM terminates.", + "description": "Whether JMX connector is created, allowing clients to connect remotely The default value is false." + }, + { + "name": "camel.main.jmx-enabled", + "type": "java.lang.Boolean", + "description": "Enable JMX in your Camel application.", "defaultValue": true }, { - "name": "camel.main.hystrix.group-key", + "name": "camel.main.jmx-management-name-pattern", "type": "java.lang.String", - "description": "Sets the group key to use. The default value is CamelHystrix." + "description": "The naming pattern for creating the CamelContext JMX management name. The default pattern is #name#", + "defaultValue": "#name#" }, { - "name": "camel.main.hystrix.thread-pool-key", - "type": "java.lang.String", - "description": "Sets the thread pool key to use. Will by default use the same value as groupKey has been configured to use." + "name": "camel.main.jmx-management-statistics-level", + "type": "org.apache.camel.ManagementStatisticsLevel", + "description": "Sets the JMX statistics level The level can be set to Extended to gather additional information The default value is Default.", + "defaultValue": "ManagementStatisticsLevel.Default" }, { - "name": "camel.main.hystrix.circuit-breaker-enabled", + "name": "camel.main.load-type-converters", "type": "java.lang.Boolean", - "description": "Whether to use a HystrixCircuitBreaker or not. If false no circuit-breaker logic will be used and all requests permitted. <p> This is similar in effect to circuitBreakerForceClosed() except that continues tracking metrics and knowing whether it should be open/closed, this property results in not even instantiating a circuit-breaker." + "description": "Whether to load custom type converters by scanning classpath. This is used for backwards compatibility with Camel 2.x. Its recommended to migrate to use fast type converter loading by setting <tt>@Converter(loader = true)</tt> on your custom type converter classes.", + "defaultValue": true }, { - "name": "camel.main.hystrix.circuit-breaker-error-threshold-percentage", + "name": "camel.main.log-debug-max-chars", "type": "java.lang.Integer", - "description": "Error percentage threshold (as whole number such as 50) at which point the circuit breaker will trip open and reject requests. <p> It will stay tripped for the duration defined in circuitBreakerSleepWindowInMilliseconds; <p> The error percentage this is compared against comes from HystrixCommandMetrics.getHealthCounts()." + "description": "Is used to limit the maximum length of the logging Camel message bodies. If the message body is longer than the limit, the log message is clipped. Use -1 to have unlimited length. Use for example 1000 to log at most 1000 characters." }, { - "name": "camel.main.hystrix.circuit-breaker-force-closed", + "name": "camel.main.log-exhausted-message-body", "type": "java.lang.Boolean", - "description": "If true the HystrixCircuitBreaker#allowRequest() will always return true to allow requests regardless of the error percentage from HystrixCommandMetrics.getHealthCounts(). <p> The circuitBreakerForceOpen() property takes precedence so if it set to true this property does nothing." + "description": "Sets whether to log exhausted message body with message history. Default is false." }, { - "name": "camel.main.hystrix.circuit-breaker-force-open", + "name": "camel.main.log-mask", "type": "java.lang.Boolean", - "description": "If true the HystrixCircuitBreaker.allowRequest() will always return false, causing the circuit to be open (tripped) and reject all requests. <p> This property takes precedence over circuitBreakerForceClosed();" + "description": "Sets whether log mask is enabled or not. Default is false." }, { - "name": "camel.main.hystrix.circuit-breaker-request-volume-threshold", - "type": "java.lang.Integer", - "description": "Minimum number of requests in the metricsRollingStatisticalWindowInMilliseconds() that must exist before the HystrixCircuitBreaker will trip. <p> If below this number the circuit will not trip regardless of error percentage." + "name": "camel.main.message-history", + "type": "java.lang.Boolean", + "description": "Sets whether message history is enabled or not. Default is true.", + "defaultValue": true }, { - "name": "camel.main.hystrix.circuit-breaker-sleep-window-in-milliseconds", - "type": "java.lang.Integer", - "description": "The time in milliseconds after a HystrixCircuitBreaker trips open that it should wait before trying requests again." + "name": "camel.main.name", + "type": "java.lang.String", + "description": "Sets the name of the CamelContext." }, { - "name": "camel.main.hystrix.execution-isolation-semaphore-max-concurrent-requests", + "name": "camel.main.producer-template-cache-size", "type": "java.lang.Integer", - "description": "Number of concurrent requests permitted to HystrixCommand.run(). Requests beyond the concurrent limit will be rejected. <p> Applicable only when executionIsolationStrategy == SEMAPHORE." + "description": "Producer template endpoints cache size.", + "defaultValue": 1000 }, { - "name": "camel.main.hystrix.execution-isolation-strategy", + "name": "camel.main.route-filter-exclude-pattern", "type": "java.lang.String", - "description": "What isolation strategy HystrixCommand.run() will be executed with. <p> If THREAD then it will be executed on a separate thread and concurrent requests limited by the number of threads in the thread-pool. <p> If SEMAPHORE then it will be executed on the calling thread and concurrent requests limited by the semaphore count." - }, - { - "name": "camel.main.hystrix.execution-isolation-thread-interrupt-on-timeout", - "type": "java.lang.Boolean", - "description": "Whether the execution thread should attempt an interrupt (using {@link Future#cancel} ) when a thread times out. <p> Applicable only when executionIsolationStrategy() == THREAD." + "description": "Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by {@link PatternHelper#matchPattern(String,String)} . For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* [...] }, { - "name": "camel.main.hystrix.execution-timeout-in-milliseconds", - "type": "java.lang.Integer", - "description": "Time in milliseconds at which point the command will timeout and halt execution. <p> If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted. If the command is semaphore-isolated and a HystrixObservableCommand, that command will get unsubscribed." + "name": "camel.main.route-filter-include-pattern", + "type": "java.lang.String", + "description": "Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by {@link PatternHelper#matchPattern(String,String)} . For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* [...] }, { - "name": "camel.main.hystrix.execution-timeout-enabled", + "name": "camel.main.shutdown-log-inflight-exchanges-on-timeout", "type": "java.lang.Boolean", - "description": "Whether the timeout mechanism is enabled for this command" + "description": "Sets whether to log information about the inflight Exchanges which are still running during a shutdown which didn't complete without the given timeout.", + "defaultValue": true }, { - "name": "camel.main.hystrix.fallback-isolation-semaphore-max-concurrent-requests", - "type": "java.lang.Integer", - "description": "Number of concurrent requests permitted to HystrixCommand.getFallback(). Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback." + "name": "camel.main.shutdown-now-on-timeout", + "type": "java.lang.Boolean", + "description": "Sets whether to force shutdown of all consumers when a timeout occurred and thus not all consumers was shutdown within that period. You should have good reasons to set this option to false as it means that the routes keep running and is halted abruptly when CamelContext has been shutdown.", + "defaultValue": true }, { - "name": "camel.main.hystrix.fallback-enabled", + "name": "camel.main.shutdown-routes-in-reverse-order", "type": "java.lang.Boolean", - "description": "Whether HystrixCommand.getFallback() should be attempted when failure occurs." + "description": "Sets whether routes should be shutdown in reverse or the same order as they where started.", + "defaultValue": true }, { - "name": "camel.main.hystrix.metrics-health-snapshot-interval-in-milliseconds", - "type": "java.lang.Integer", - "description": "Time in milliseconds to wait between allowing health snapshots to be taken that calculate success and error percentages and affect HystrixCircuitBreaker.isOpen() status. <p> On high-volume circuits the continual calculation of error percentage can become CPU intensive thus this controls how often it is calculated." + "name": "camel.main.shutdown-suppress-logging-on-timeout", + "type": "java.lang.Boolean", + "description": "Whether Camel should try to suppress logging during shutdown and timeout was triggered, meaning forced shutdown is happening. And during forced shutdown we want to avoid logging errors/warnings et all in the logs as a side-effect of the forced timeout. Notice the suppress is a best effort as there may still be some logs coming from 3rd party libraries and whatnot, which Camel cannot control. This option is default false." }, { - "name": "camel.main.hystrix.metrics-rolling-percentile-bucket-size", + "name": "camel.main.shutdown-timeout", "type": "java.lang.Integer", - "description": "Maximum number of values stored in each bucket of the rolling percentile. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." + "description": "Timeout in seconds to graceful shutdown Camel.", + "defaultValue": 300 }, { - "name": "camel.main.hystrix.metrics-rolling-percentile-enabled", + "name": "camel.main.stream-caching-any-spool-rules", "type": "java.lang.Boolean", - "description": "Whether percentile metrics should be captured using HystrixRollingPercentile inside HystrixCommandMetrics." + "description": "Sets whether if just any of the org.apache.camel.spi.StreamCachingStrategy.SpoolRule rules returns true then shouldSpoolCache(long) returns true, to allow spooling to disk. If this option is false, then all the org.apache.camel.spi.StreamCachingStrategy.SpoolRule must return true. The default value is false which means that all the rules must return true." }, { - "name": "camel.main.hystrix.metrics-rolling-percentile-window-in-milliseconds", + "name": "camel.main.stream-caching-buffer-size", "type": "java.lang.Integer", - "description": "Duration of percentile rolling window in milliseconds. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." + "description": "Sets the stream caching buffer size to use when allocating in-memory buffers used for in-memory stream caches. The default size is 4096." }, { - "name": "camel.main.hystrix.metrics-rolling-percentile-window-buckets", - "type": "java.lang.Integer", - "description": "Number of buckets the rolling percentile window is broken into. This is passed into HystrixRollingPercentile inside HystrixCommandMetrics." + "name": "camel.main.stream-caching-enabled", + "type": "java.lang.Boolean", + "description": "Sets whether stream caching is enabled or not. Default is false." }, { - "name": "camel.main.hystrix.metrics-rolling-statistical-window-in-milliseconds", - "type": "java.lang.Integer", - "description": "This property sets the duration of the statistical rolling window, in milliseconds. This is how long metrics are kept for the thread pool. The window is divided into buckets and “rolls” by those increments." + "name": "camel.main.stream-caching-remove-spool-directory-when-stopping", + "type": "java.lang.Boolean", + "description": "Whether to remove stream caching temporary directory when stopping. This option is default true.", + "defaultValue": true }, { - "name": "camel.main.hystrix.metrics-rolling-statistical-window-buckets", - "type": "java.lang.Integer", - "description": "Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside HystrixCommandMetrics." + "name": "camel.main.stream-caching-spool-cipher", + "type": "java.lang.String", + "description": "Sets a stream caching cipher name to use when spooling to disk to write with encryption. By default the data is not encrypted." }, { - "name": "camel.main.hystrix.request-log-enabled", - "type": "java.lang.Boolean", - "description": "Whether HystrixCommand execution and events should be logged to HystrixRequestLog." + "name": "camel.main.stream-caching-spool-directory", + "type": "java.lang.String", + "description": "Sets the stream caching spool (temporary) directory to use for overflow and spooling to disk. If no spool directory has been explicit configured, then a temporary directory is created in the java.io.tmpdir directory." }, { - "name": "camel.main.hystrix.core-pool-size", - "type": "java.lang.Integer", - "description": "Core thread-pool size that gets passed to {@link java.util.concurrent.ThreadPoolExecutor#setCorePoolSize(int)}" + "name": "camel.main.stream-caching-spool-threshold", + "type": "java.lang.Long", + "description": "Stream caching threshold in bytes when overflow to disk is activated. The default threshold is 128kb. Use -1 to disable overflow to disk." }, { - "name": "camel.main.hystrix.maximum-size", - "type": "java.lang.Integer", - "description": "Maximum thread-pool size that gets passed to {@link ThreadPoolExecutor#setMaximumPoolSize(int)} . This is the maximum amount of concurrency that can be supported without starting to reject HystrixCommands. Please note that this setting only takes effect if you also set allowMaximumSizeToDivergeFromCoreSize" + "name": "camel.main.stream-caching-spool-used-heap-memory-limit", + "type": "java.lang.String", + "description": "Sets what the upper bounds should be when streamCachingSpoolUsedHeapMemoryThreshold is in use." }, { - "name": "camel.main.hystrix.keep-alive-time", + "name": "camel.main.stream-caching-spool-used-heap-memory-threshold", "type": "java.lang.Integer", - "description": "Keep-alive time in minutes that gets passed to {@link ThreadPoolExecutor#setKeepAliveTime(long,TimeUnit)}" + "description": "Sets a percentage (1-99) of used heap memory threshold to activate stream caching spooling to disk." }, { - "name": "camel.main.hystrix.max-queue-size", - "type": "java.lang.Integer", - "description": "Max queue size that gets passed to {@link BlockingQueue} in HystrixConcurrencyStrategy.getBlockingQueue(int) This should only affect the instantiation of a threadpool - it is not eliglible to change a queue size on the fly. For that, use queueSizeRejectionThreshold()." + "name": "camel.main.stream-caching-statistics-enabled", + "type": "java.lang.Boolean", + "description": "Sets whether stream caching statistics is enabled." }, { - "name": "camel.main.hystrix.queue-size-rejection-threshold", - "type": "java.lang.Integer", - "description": "Queue size rejection threshold is an artificial max size at which rejections will occur even if {@link #maxQueueSize} has not been reached. This is done because the {@link #maxQueueSize} of a {@link BlockingQueue} can not be dynamically changed and we want to support dynamically changing the queue size that affects rejections. <p> This is used by HystrixCommand when queuing a thread for execution." + "name": "camel.main.thread-name-pattern", + "type": "java.lang.String", + "description": "Sets the thread name pattern used for creating the full thread name. The default pattern is: Camel (#camelId#) thread ##counter# - #name# Where #camelId# is the name of the CamelContext. and #counter# is a unique incrementing counter. and #name# is the regular thread name. You can also use #longName# which is the long thread name which can includes endpoint parameters etc." }, { - "name": "camel.main.hystrix.thread-pool-rolling-number-statistical-window-in-milliseconds", - "type": "java.lang.Integer", - "description": "Duration of statistical rolling window in milliseconds. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance." + "name": "camel.main.tracing", + "type": "java.lang.Boolean", + "description": "Sets whether tracing is enabled or not. Default is false." }, { - "name": "camel.main.hystrix.thread-pool-rolling-number-statistical-window-buckets", - "type": "java.lang.Integer", - "description": "Number of buckets the rolling statistical window is broken into. This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance." + "name": "camel.main.use-breadcrumb", + "type": "java.lang.Boolean", + "description": "Set whether breadcrumb is enabled. The default value is false." }, { - "name": "camel.main.hystrix.allow-maximum-size-to-diverge-from-core-size", + "name": "camel.main.use-data-type", "type": "java.lang.Boolean", - "description": "Allows the configuration for maximumSize to take effect. That value can then be equal to, or higher, than coreSize" + "description": "Whether to enable using data type on Camel messages. Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. Otherwise data type is default off." + }, + { + "name": "camel.main.use-mdc-logging", + "type": "java.lang.Boolean", + "description": "To turn on MDC logging" }, { "name": "camel.component.bean.cache", @@ -947,7 +947,7 @@ "defaultValue": false }, { - "name": "camel.component.jms.include-all-jms-x-properties", + "name": "camel.component.jms.include-all-jmsx-properties", "type": "java.lang.Boolean", "description": "Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID, and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply.", "defaultValue": false diff --git a/tooling/maven/camel-main-package-maven-plugin/pom.xml b/tooling/maven/camel-main-package-maven-plugin/pom.xml index ed19fd8..99f8da8 100644 --- a/tooling/maven/camel-main-package-maven-plugin/pom.xml +++ b/tooling/maven/camel-main-package-maven-plugin/pom.xml @@ -83,6 +83,10 @@ <artifactId>camel-main-parser</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-util</artifactId> + </dependency> <!-- logging --> <dependency> diff --git a/tooling/maven/camel-main-package-maven-plugin/src/main/java/org/apache/camel/maven/PrepareCamelMainMojo.java b/tooling/maven/camel-main-package-maven-plugin/src/main/java/org/apache/camel/maven/PrepareCamelMainMojo.java index 6211fb4..4f05d67 100644 --- a/tooling/maven/camel-main-package-maven-plugin/src/main/java/org/apache/camel/maven/PrepareCamelMainMojo.java +++ b/tooling/maven/camel-main-package-maven-plugin/src/main/java/org/apache/camel/maven/PrepareCamelMainMojo.java @@ -31,6 +31,8 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; +import static org.apache.camel.util.StringHelper.camelCaseToDash; + /** * Prepares camel-main by generating Camel Main configuration metadata for tooling support. */ @@ -128,31 +130,6 @@ public class PrepareCamelMainMojo extends AbstractMojo { } } - private static String camelCaseToDash(String name) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < name.length(); i++) { - char ch = name.charAt(i); - if (Character.isUpperCase(ch)) { - sb.append("-"); - sb.append(Character.toLowerCase(ch)); - } else { - sb.append(ch); - } - } - - // somme words we dont want ID -> i-d, but keep it as id - String answer = sb.toString(); - answer = answer.replaceAll("-i-d-", "-id-"); - answer = answer.replaceAll("-u-r-i-", "-uri-"); - answer = answer.replaceAll("-u-r-l-", "-url-"); - answer = answer.replaceAll("-j-m-s-", "-jms-"); - answer = answer.replaceAll("-j-m-x-", "-jmx-"); - answer = answer.replaceFirst("-i-d$", "-id"); - answer = answer.replaceFirst("-u-r-i$", "-uri"); - answer = answer.replaceFirst("-u-r-l$", "-url"); - return answer; - } - private static String springBootJavaType(String javaType) { if ("boolean".equalsIgnoreCase(javaType)) { return "java.lang.Boolean";