You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2024/04/17 06:05:41 UTC
(camel) 01/02: Fix endpoint builders
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 71355cb4c8b112f7a057f5efa0ded3a8bacf0774
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Apr 17 07:52:32 2024 +0200
Fix endpoint builders
---
.../builder/endpoint/StaticEndpointBuilders.java | 22 ++++++------
.../camel/maven/packaging/EndpointDslMojo.java | 2 +-
.../main/resources/velocity/endpoint-builder.vm | 39 ++++++++++------------
.../resources/velocity/endpoint-static-builders.vm | 6 ++--
4 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index d4e21493c6f..22fb4e2cfdc 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -2605,7 +2605,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static CoAPEndpointBuilderFactory.CoAPEndpointBuilder coapTcp(String path) {
- return coapTcp("coap+tcp", path);
+ return coap("coap+tcp", path);
}
/**
* CoAP (Secure) (camel-coap)
@@ -2624,7 +2624,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static CoAPEndpointBuilderFactory.CoAPEndpointBuilder coaps(String path) {
- return coaps("coaps", path);
+ return coap("coaps", path);
}
/**
* CoAP (camel-coap)
@@ -2643,7 +2643,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static CoAPEndpointBuilderFactory.CoAPEndpointBuilder coapsTcp(String path) {
- return coapsTcp("coaps+tcp", path);
+ return coap("coaps+tcp", path);
}
/**
* CometD (camel-cometd)
@@ -2726,7 +2726,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static CometdEndpointBuilderFactory.CometdEndpointBuilder cometds(String path) {
- return cometds("cometds", path);
+ return cometd("cometds", path);
}
/**
* Consul (camel-consul)
@@ -6319,7 +6319,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static HttpEndpointBuilderFactory.HttpEndpointBuilder https(String path) {
- return https("https", path);
+ return http("https", path);
}
/**
* Huawei Distributed Message Service (DMS) (camel-huaweicloud-dms)
@@ -7047,7 +7047,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static MailEndpointBuilderFactory.MailEndpointBuilder imaps(String path) {
- return imaps("imaps", path);
+ return imap("imaps", path);
}
/**
* Infinispan (camel-infinispan)
@@ -11547,7 +11547,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static MailEndpointBuilderFactory.MailEndpointBuilder pop3(String path) {
- return pop3("pop3", path);
+ return imap("pop3", path);
}
/**
* POP3S (camel-mail)
@@ -11569,7 +11569,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static MailEndpointBuilderFactory.MailEndpointBuilder pop3s(String path) {
- return pop3s("pop3s", path);
+ return imap("pop3s", path);
}
/**
* PubNub (camel-pubnub)
@@ -13012,7 +13012,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static SmppEndpointBuilderFactory.SmppEndpointBuilder smpps(String path) {
- return smpps("smpps", path);
+ return smpp("smpps", path);
}
/**
* SMTP (camel-mail)
@@ -13034,7 +13034,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static MailEndpointBuilderFactory.MailEndpointBuilder smtp(String path) {
- return smtp("smtp", path);
+ return imap("smtp", path);
}
/**
* SMTPS (camel-mail)
@@ -13056,7 +13056,7 @@ public class StaticEndpointBuilders {
* @return the dsl builder
*/
public static MailEndpointBuilderFactory.MailEndpointBuilder smtps(String path) {
- return smtps("smtps", path);
+ return imap("smtps", path);
}
/**
* SNMP (camel-snmp)
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index 9e565fb7e34..63344754a47 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -416,7 +416,7 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
return JavadocHelper.xmlEncode(str);
}
- public String printJavadoc(String indent, String doc) {
+ public String javadoc(String indent, String doc) {
StringBuilder sb = new StringBuilder();
List<String> lines = formatJavadocOrCommentStringAsList(doc, indent);
if (!lines.isEmpty()) {
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-builder.vm b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-builder.vm
index a0e0593c244..5c2e3a23950 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-builder.vm
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-builder.vm
@@ -45,7 +45,7 @@ import org.apache.camel.builder.EndpointConsumerBuilder;
import org.apache.camel.builder.EndpointProducerBuilder;
import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
-${mojo.printJavadoc("", $model.description + $newline + $newline + "Generated by camel build tools - do NOT edit this file!")}
+${mojo.javadoc("", $model.description + $newline + $newline + "Generated by camel build tools - do NOT edit this file!")}
@Generated("${generatorClass}")
public interface ${builderName}Factory {
@@ -58,17 +58,15 @@ public interface ${builderName}Factory {
#if( (($advanced && $label.contains("advanced")) || (!$advanced && !$label.contains("advanced")))
&& ( $label.contains("producer") && ($cpb == 1 || $model.producerOnly) || !$label.contains("producer") )
&& ( $label.contains("consumer") && ($cpb == 0 || $model.consumerOnly) || !$label.contains("consumer") ) )
- #set( $basedesc = $mojo.createBaseDescription($option, "parameter", false) )
#if( $option.multiValue )
- #set( $javadoc = $basedesc.replace("@@REPLACE_ME@@", $newline
+ #set( $javadoc = $mojo.createBaseDescription($option, "parameter", false, $newline
+ "The option is a: <code>" + $option.javaType.replace("<", "<").replace(">", ">")
+ "</code> type.") )
- #set( $javadoc = $mojo.xmlEncode($javadoc) )
#set( $javadoc = $javadoc + $newline + $newline
+ "@param key the option key" + $newline
+ "@param value the option value" + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $option.deprecated )
@Deprecated
#end
@@ -76,14 +74,13 @@ public interface ${builderName}Factory {
doSetMultiValueProperty("${option.name}", "${option.prefix}" + key, value);
return this;
}
- #set( $javadoc = $basedesc.replace("@@REPLACE_ME@@", $newline
+ #set( $javadoc = $mojo.createBaseDescription($option, "parameter", false, $newline
+ "The option is a: <code>" + $option.javaType.replace("<", "<").replace(">", ">")
+ "</code> type.") )
- #set( $javadoc = $mojo.xmlEncode($javadoc) )
#set( $javadoc = $javadoc + $newline + $newline
+ "@param values the values" + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $option.deprecated )
@Deprecated
#end
@@ -92,14 +89,13 @@ public interface ${builderName}Factory {
return this;
}
#else
- #set( $javadoc = $basedesc.replace("@@REPLACE_ME@@", $newline
+ #set( $javadoc = $mojo.createBaseDescription($option, "parameter", false, $newline
+ "The option is a: <code>" + $option.javaType.replace("<", "<").replace(">", ">")
+ "</code> type.") )
- #set( $javadoc = $mojo.xmlEncode($javadoc) )
#set( $javadoc = $javadoc + $newline + $newline
+ "@param " + $option.name + " the value to set" + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $option.deprecated )
@Deprecated
#end
@@ -108,14 +104,13 @@ public interface ${builderName}Factory {
return this;
}
#if( $option.javaType != "java.lang.String" )
- #set( $javadoc = $basedesc.replace("@@REPLACE_ME@@", $newline
+ #set( $javadoc = $mojo.createBaseDescription($option, "parameter", false, $newline
+ "The option will be converted to a <code>" + $option.javaType.replace("<", "<").replace(">", ">")
+ "</code> type.") )
- #set( $javadoc = $mojo.xmlEncode($javadoc) )
#set( $javadoc = $javadoc + $newline + $newline
+ "@param " + $option.name + " the value to set" + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $option.deprecated )
@Deprecated
#end
@@ -258,7 +253,7 @@ public interface ${builderName}Factory {
#if( !$model.endpointHeaders.empty )
#set( $javadoc = $mojo.getMainDescription($model, false) + $newline + $newline
+ "@return the dsl builder for the headers' name." + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $model.deprecated )
@Deprecated
#end
@@ -270,7 +265,7 @@ public interface ${builderName}Factory {
#set( $javadoc = $mojo.getMainDescription($model, true) + $newline + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($model) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $model.deprecated )
@Deprecated
#end
@@ -281,7 +276,7 @@ public interface ${builderName}Factory {
+ "@param componentName to use a custom component name for the endpoint instead of the default name" + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($model) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $model.deprecated )
@Deprecated
#end
@@ -294,7 +289,7 @@ public interface ${builderName}Factory {
#set( $javadoc = $mojo.getMainDescription($componentModel, true) + $newline + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($componentModel) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $componentModel.deprecated )
@Deprecated
#end
@@ -307,7 +302,7 @@ public interface ${builderName}Factory {
+ "@param componentName to use a custom component name for the endpoint instead of the default name" + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($componentModel) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $componentModel.deprecated )
@Deprecated
#end
@@ -338,10 +333,10 @@ public interface ${builderName}Factory {
#set( $headerName = $headerName.substring(5) )
#end
#set( $name = $mojo.headerNameMethodName($headerName) )
- #set( $javadoc = $mojo.createBaseDescription($header, "header", true) )
- #set( $javadoc = $javadoc.replace("@@REPLACE_ME@@", "${newline}The option is a: {@code " + $header.getJavaType() + "} type.") )
+ #set( $javadoc = $mojo.createBaseDescription($header, "header", true,
+ "${newline}The option is a: {@code " + $header.getJavaType() + "} type.") )
#set( $javadoc = "$javadoc${newline}${newline}@return the name of the header {@code ${headerName}}." )
- ${mojo.printJavadoc(" ", $javadoc)}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $header.deprecated )
@Deprecated
#end
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-static-builders.vm b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-static-builders.vm
index e1da4c421e9..0c087471b35 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-static-builders.vm
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/velocity/endpoint-static-builders.vm
@@ -50,19 +50,19 @@ public class StaticEndpointBuilders {
#set( $javadoc = $mojo.getMainDescription($model, true) + $newline + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($model) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc).trim()}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $model.deprecated )
@Deprecated
#end
public static ${builderName}Factory.${builderName} ${mojo.camelCaseLower($model.scheme)}(String path) {
- return ${mojo.camelCaseLower($model.scheme)}("${model.scheme}", path);
+ return ${mojo.camelCaseLower($models.get($model.javaType).get(0).scheme)}("${model.scheme}", path);
}
#if( $firstAlias )
#set( $javadoc = $mojo.getMainDescription($model, true) + $newline + $newline
+ "@param componentName to use a custom component name for the endpoint instead of the default name" + $newline
+ "@param path " + $mojo.pathParameterJavaDoc($model) + $newline
+ "@return the dsl builder" + $newline )
- ${mojo.printJavadoc(" ", $javadoc).trim()}
+ ${mojo.javadoc(" ", $javadoc)}
#if( $model.deprecated )
@Deprecated
#end