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 2018/07/17 13:45:00 UTC
[camel] 02/13: CAMEL-12644: Generate spring boot auto configuration
in the docs.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-12644
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 84d495d1859d3727b83d9a9f98887b23c991ec91
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jul 16 20:14:30 2018 +0200
CAMEL-12644: Generate spring boot auto configuration in the docs.
---
components/camel-zipkin/src/main/docs/zipkin.adoc | 34 ++++++++++++++++++++++
...pdateSpringBootAutoConfigurationReadmeMojo.java | 5 ++++
.../model/SpringBootAutoConfigureOptionModel.java | 15 +++++-----
3 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/components/camel-zipkin/src/main/docs/zipkin.adoc b/components/camel-zipkin/src/main/docs/zipkin.adoc
index 6e3057b..37e1c08 100644
--- a/components/camel-zipkin/src/main/docs/zipkin.adoc
+++ b/components/camel-zipkin/src/main/docs/zipkin.adoc
@@ -88,6 +88,40 @@ link:how-do-i-set-the-max-chars-when-debug-logging-messages-in-camel.html[max
debug log size].
|===
+// spring-boot-auto-configure options: START
+=== Spring Boot Auto-Configuration
+
+
+The component supports 10 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *camel.zipkin.client-service-mappings* | Sets client service mapping(s) that matches Camel events to the given zipkin service name.
+ The key is the pattern, the value is the service name. | | Map
+| *camel.zipkin.endpoint* | Sets the POST URL for zipkin's <a href="http://zipkin.io/zipkin-api/#/">v2 api</a>, usually
+ "http://zipkinhost:9411/api/v2/spans" | | String
+| *camel.zipkin.exclude-patterns* | Sets exclude pattern(s) that will disable tracing with zipkin for Camel messages that matches the pattern. | | Set
+| *camel.zipkin.host-name* | Sets the hostname if sending spans to a remote zipkin scribe (thrift RPC) collector. | | String
+| *camel.zipkin.include-message-body* | Whether to include the Camel message body in the zipkin traces.
+
+ This is not recommended for production usage, or when having big payloads.
+ You can limit the size by configuring camel.springboot.log-debug-max-chars option. | false | boolean
+| *camel.zipkin.include-message-body-streams* | Whether to include message bodies that are stream based in the zipkin traces.
+
+ This is not recommended for production usage, or when having big payloads.
+ You can limit the size by configuring camel.springboot.log-debug-max-chars option. | false | boolean
+| *camel.zipkin.port* | Sets the port if sending spans to a remote zipkin scribe (thrift RPC) collector. | 0 | int
+| *camel.zipkin.rate* | Configures a rate that decides how many events should be traced by zipkin.
+ The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%). | 1 | float
+| *camel.zipkin.server-service-mappings* | Sets server service mapping(s) that matches Camel events to the given zipkin service name.
+ The key is the pattern, the value is the service name. | | Map
+| *camel.zipkin.service-name* | To use a global service name that matches all Camel events | | String
+|===
+// spring-boot-auto-configure options: END
+
[[camel-zipkin-Example]]
=== Example
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
index 8ebb68f..0fad8af 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
@@ -110,7 +110,12 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
// update all adoc files (as it may be component, language, data-format or just other kind)
File[] docFiles = docFolder.listFiles((f) -> f.getName().startsWith(componentName) && f.getName().endsWith(".adoc"));
if (docFiles != null && docFiles.length > 0) {
+ boolean onlyOther = docFiles.length == 1 && docFiles[0].getName().equals(componentName + ".adoc");
List models = parseSpringBootAutoConfigreModels(jsonFile);
+ if (models.isEmpty() && onlyOther) {
+ // there are no spring-boot auto configuration for this other kind of JAR so lets just ignore this
+ return;
+ }
String options = templateAutoConfigurationOptions(models);
for (File docFile : docFiles) {
boolean updated = updateAutoConfigureOptions(docFile, options);
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/SpringBootAutoConfigureOptionModel.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/SpringBootAutoConfigureOptionModel.java
index 686896a..4f825f0 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/SpringBootAutoConfigureOptionModel.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/model/SpringBootAutoConfigureOptionModel.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.maven.packaging.model;
+import java.util.Locale;
+
import static org.apache.camel.maven.packaging.StringHelper.wrapCamelCaseWords;
public class SpringBootAutoConfigureOptionModel {
@@ -77,13 +79,12 @@ public class SpringBootAutoConfigureOptionModel {
text = text.substring(pos + 1);
}
- // use non wrapped types
- if ("Boolean".equals(text)) {
- text = "boolean";
- } else if ("Long".equals(text)) {
- text = "long";
- } else if ("Integer".equals(text)) {
- text = "int";
+ // favour using simple types for known java.lang wrapper types
+ if (javaType.startsWith("java.lang.") && !"String".equals(text)) {
+ text = text.toLowerCase(Locale.US);
+ if ("integer".equals(text)) {
+ text = "int";
+ }
}
return text;