This is an automated email from the ASF dual-hosted git repository. zregvart pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit c29ede9eae48b9fb0f9e213900628a8145e97ab2 Author: David Jencks <djen...@apache.org> AuthorDate: Mon Sep 13 21:04:30 2021 +0200 CAMEL-16639: Use `jsonpathTable2` macro in docs This uses the `jsonpathTable2` macro to generate the configuration instead of the UpdateReadmeMojo. This way the content of the configuration tables is generated directly from the JSON Camel metadata files during the website build; eliminating need to regenerate the .adoc files. --- .../docs/modules/eips/partials/eip-options.adoc | 23 +++ .../ROOT/partials/component-configure-options.adoc | 3 +- .../ROOT/partials/component-endpoint-options.adoc | 154 ++++++++++++++++++++ .../dataformats/partials/dataformat-options.adoc | 23 +++ .../languages/partials/language-options.adoc | 23 +++ docs/gulpfile.js | 19 +-- .../camel/maven/packaging/UpdateReadmeMojo.java | 161 ++------------------- .../src/main/resources/component-options.mvel | 17 +-- .../src/main/resources/dataformat-options.mvel | 14 +- .../src/main/resources/eip-options.mvel | 12 +- .../src/main/resources/endpoint-options.mvel | 113 --------------- .../src/main/resources/language-options.mvel | 14 +- 12 files changed, 250 insertions(+), 326 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc b/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc new file mode 100644 index 0000000..12749e9 --- /dev/null +++ b/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc @@ -0,0 +1,23 @@ +:tablespec: width="100%",cols="2,5a,^1,2",options="header" +:cellformats: '`[#_option_${path[2]}]*${path[2]}*` \ +|util.description(value) \ +| value.defaultValue ? `${value.defaultValue}` : "" \ +|util.javaSimpleName(value.javaType)' +:requires: 'util=util/jsonpath-util.js' +include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id" && @.displayName!="Description" && @.displayName!="Expression" && @.displayName!="Outputs")]'] + +ifeval::[{optioncount} == 0] +The {docTitle} eip has no options. +endif::[] +ifeval::[{optioncount} != 0] +The {docTitle} eip supports {optioncount} options, which are listed below. + + +[{tablespec}] +|=== +| Name | Description | Default | Type +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}] +endif::[] + diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel b/docs/components/modules/ROOT/partials/component-configure-options.adoc similarity index 96% rename from tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel rename to docs/components/modules/ROOT/partials/component-configure-options.adoc index 18c6ba4..cc28c29 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel +++ b/docs/components/modules/ROOT/partials/component-configure-options.adoc @@ -1,3 +1,4 @@ +// component-configure options: START == Configuring Options Camel components are configured on two separate levels: @@ -30,4 +31,4 @@ which allows to not hardcode urls, port numbers, sensitive information, and othe In other words placeholders allows to externalize the configuration from your code, and gives more flexibility and reuse. The following two sections lists all the options, firstly for the component followed by the endpoint. - +// component-configure options: END diff --git a/docs/components/modules/ROOT/partials/component-endpoint-options.adoc b/docs/components/modules/ROOT/partials/component-endpoint-options.adoc new file mode 100644 index 0000000..62beafa --- /dev/null +++ b/docs/components/modules/ROOT/partials/component-endpoint-options.adoc @@ -0,0 +1,154 @@ +//component options: START + +:tablespec: width="100%",cols="2,5a,^1,2",options="header" +:base-option-name: ${path[2]}]*${path[2]}* (${value.group})` +:component-option-name: `[#_component_option_{base-option-name} +:endpoint-path-option-name: `[#_endpoint_path_option_{base-option-name} +:endpoint-query-option-name: `[#_endpoint_query_option_{base-option-name} +:last-cell-formats: |util.description(value) \ +|value.defaultValue ? `${value.defaultValue}` : "" \ +|util.javaSimpleName(value.javaType) +:requires: 'util=util/jsonpath-util.js' +include::jsonpath$example$json/{shortName}.json[query='$.component',formats='name,scheme,pascalcasescheme=util.pascalCase(scheme),syntax,apiSyntax', requires={requires}] +include::jsonpathcount$example$json/{shortName}.json[queries='pathparametercount=nodes$.properties[?(@.kind=="path")],queryparametercount=nodes$.properties[?(@.kind=="parameter")],apicount=nodes$.apis.*'] + +== Component Options + +The {docTitle} component supports jsonpathCount:example$json/{shortName}.json['nodes$.componentProperties.*'] options, which are listed below. + +[{tablespec}] +|=== +| Name | Description | Default | Type +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.componentProperties.*','{component-option-name}{last-cell-formats}',{requires}] + + +// endpoint options: START +== Endpoint Options + +The {docTitle} endpoint is configured using URI syntax: + +[subs='+attributes'] +---- +{syntax} +---- + +with the following path and query parameters: + +=== Path Parameters ({pathparametercount} parameters) + +ifeval::[{pathparametercount} == 0] +The {docTitle} endpoint has no path parameters. +endif::[] + +ifeval::[{pathparametercount} != 0] +[{tablespec}] +|=== +| Name | Description | Default | Type +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="path")]','{endpoint-path-option-name}{last-cell-formats}',{requires}] + +endif::[] + +[#_query_parameters] +=== Query Parameters ({queryparametercount} parameters) + +ifeval::[{queryparametercount} == 0] +The {docTitle} endpoint has no query parameters. +endif::[] + +ifeval::[{queryparametercount} != 0] +[{tablespec}] +|=== +| Name | Description | Default | Type +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="parameter")]','{endpoint-query-option-name}{last-cell-formats}',{requires}] +endif::[] + +ifeval::[{apicount} != 0] + +== API Parameters ({apicount} APIs) + +The @{docTitle} endpoint is an API based component and has additional parameters based on which API name and API method is used. +The API name and API method is located in the endpoint URI as the `{apiSyntax}` path parameters: + +[subs='+attributes'] +---- +{syntax} +---- + +There are {apicount} API names as listed in the table below: + +[width="100%",cols="2,2,6a",options="header"] +|=== +| API Name | Type | Description +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.apis.*','`<<#_api_${path[2]},*${path[2]}*>>`| value.consumerOnly ? "Consumer" : value.producerOnly ? "Producer" : "Both" | value.description'] + +Each API is documented in the following sections to come. + +[jsonpathBlock2, example$json/{shortName}.json, 'nodes$.apis.*','apiname=path[2], producer-consumer = util.producerConsumerLong(value.consumerOnly\, value.producerOnly), methodcount=Object.keys(value.methods).length, aliases=value.aliases', {requires}] +---- + +[#_api_{apiname}] +=== API: {apiName} + +*{producer-consumer}* + +%ifeval::[{methodcount} == 0] +The {apiName} has no API methods. +%endif::[] + +%ifeval::[{methodcount} != 0] + +The {apiname} API is defined in the syntax as follows: + +[source,subs=+attributes] +------ +{scheme}:{apiname}/methodName?[parameters] +------ + +The {methodcount} method(s) is listed in the table below, followed by detailed syntax for each method. +(API methods can have a shorthand alias name which can be used in the syntax instead of the name) + +[width="100%",cols="2,2,6a",options="header"] +|=== +| Method | Alias | Description +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.apis["{apiname}"].methods.*','`<<#_api_{apiname}_method_${path[4]},*${path[4]}*>>`|util.alias(path[4], "{aliases}")|value.description', {requires}] + +[jsonpathBlock2, example$json/{shortName}.json, 'nodes$.apis["{apiname}"].methods.*','methodname=path[4]', {requires}] +------ +[#_api_{apiname}_method_{methodname}] +==== Method {methodname} + +Signatures: + +jsonpathList2::example$json/{shortName}.json['nodes$.apis["{apiname}"].methods["{methodname}"].signatures.*','util.formatSignature(value)', {requires}] + +The {name}/{methodname} API method has the parameters listed in the table below: + +[width="100%",cols="2,4a,2",options="header"] +|=== +| Parameter | Description | Type +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.apiProperties["{apiname}"].methods["{methodname}"].properties.*','`*${path[6]}*`|`${util.strong(value, "Required")} ${value.description}`|util.javaSimpleName(value.javaType)', {requires}] + +------ + +In addition to the parameters above, the {name} API can also use any of the <<#_query_parameters>>. + +Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. +The message header name must be of the format `Camel{pascalcasescheme}.parameter`. +The `inBody` parameter overrides message header, i.e. the endpoint parameter `inBody=myParameterNameHere` +would override a `Camel{pascalcasescheme}.myParameterNameHere` header. + +%endif::[] +---- +endif::[] diff --git a/docs/components/modules/dataformats/partials/dataformat-options.adoc b/docs/components/modules/dataformats/partials/dataformat-options.adoc new file mode 100644 index 0000000..ab3a675 --- /dev/null +++ b/docs/components/modules/dataformats/partials/dataformat-options.adoc @@ -0,0 +1,23 @@ +:tablespec: width="100%",cols="2,1m,1m,6a",options="header" +:cellformats: '` [#_option_${path[2]}]*${path[2]}* ` \ +| value.defaultValue ? `${value.defaultValue}` : "" \ +|util.pascalCase(value.type) \ +|util.description(value)' +:requires: 'util=util/jsonpath-util.js' +include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id")]'] + +ifeval::[{optioncount} == 0] +The {docTitle} dataformat has no options. +endif::[] +ifeval::[{optioncount} != 0] +The {docTitle} dataformat supports {optioncount} options, which are listed below. + + +[{tablespec}] +|=== +| Name | Default | Java Type | Description +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}] +endif::[] + diff --git a/docs/components/modules/languages/partials/language-options.adoc b/docs/components/modules/languages/partials/language-options.adoc new file mode 100644 index 0000000..3b5ffdf --- /dev/null +++ b/docs/components/modules/languages/partials/language-options.adoc @@ -0,0 +1,23 @@ +:tablespec: width="100%",cols="2,1m,1m,6a",options="header" +:cellformats: '`[#_option_${path[2]}]*${path[2]}*` \ +| value.defaultValue ? `${value.defaultValue}` : "" \ +|util.pascalCase(value.type) \ +|util.description(value)' +:requires: 'util=util/jsonpath-util.js' +include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.kind=="attribute" && @.displayName!="Id")]'] + +ifeval::[{optioncount} == 0] +The {docTitle} language has no options. +endif::[] +ifeval::[{optioncount} != 0] +The {docTitle} language supports {optioncount} options, which are listed below. + + +[{tablespec}] +|=== +| Name | Default | Java Type | Description +|=== + +jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="attribute" && @.displayName!="Id")]',{cellformats},{requires}] +endif::[] + diff --git a/docs/gulpfile.js b/docs/gulpfile.js index baaad14..a49a1b7 100644 --- a/docs/gulpfile.js +++ b/docs/gulpfile.js @@ -180,6 +180,13 @@ const sources = { 'reactive-threadpoolfactory-vertx.adoc', // not part of any component ], }, + json: { + source: [ + '../components/{*,*/*,*/*/*}/src/generated/resources/*.json', + ], + destination: 'components/modules/others/examples/json', + filter: (content) => JSON.parse(content).other, // check if there is a "other" key at the root + }, }, eips: { json: { @@ -201,11 +208,8 @@ const sources = { }, } -// NOTE: json symlinks are currently disabled, pending work completion -// on the jsonpath macro usage -// -// `symlinkTasks` is a tree of Gulp tasks it will be created from the -// data structure above. For example given: +// Generates a tree of Gulp tasks it will be created from the data +// structure above. For example given: // // taskName: { // asciidoc: { @@ -425,10 +429,7 @@ const tasks = Array.from(sourcesMap).flatMap(([type, definition]) => { ) } - // NOTE: json symlinks are currently disabled, pending work completion - // on the jsonpath macro usage - const disabled = true // remove altogether - if (!disabled && json) { + if (json) { allTasks.push( series( named(`clean:json:${type}`, clean, json.destination, json.keep), diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java index f58b540..069b5db 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java @@ -45,7 +45,6 @@ import org.apache.camel.tooling.model.BaseOptionModel; import org.apache.camel.tooling.model.ComponentModel; import org.apache.camel.tooling.model.DataFormatModel; import org.apache.camel.tooling.model.EipModel; -import org.apache.camel.tooling.model.EipModel.EipOptionModel; import org.apache.camel.tooling.model.JsonMapper; import org.apache.camel.tooling.model.LanguageModel; import org.apache.camel.tooling.model.OtherModel; @@ -201,14 +200,11 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { option.setDescription(desc); }); - String options = evaluateTemplate("component-configure-header.mvel", model); - updated |= updateOptionsIn(file, kind + "-configure", options); - - options = evaluateTemplate("component-options.mvel", model); + updated |= updateOptionsIn(file, "component-configure", ""); + String options = evaluateTemplate("component-options.mvel", model); updated |= updateOptionsIn(file, kind, options); - options = evaluateTemplate("endpoint-options.mvel", model); - updated |= updateOptionsIn(file, "endpoint", options); + updated |= updateOptionsIn(file, "endpoint", ""); if (updated) { getLog().info("Updated doc file: " + file); @@ -261,24 +257,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { throw new MojoExecutionException("Failed build due failFast=true"); } } - - if (updated || exists) { - try { - // if we run in camel-core project then add additional meta-data - File rootFile = findCamelDirectory(project.getBasedir(), "core/camel-core"); - if (rootFile != null) { - Path root = rootFile.toPath().getParent().getParent(); - String text = PackageHelper.loadText(file); - String rep = "$1\n" - + "//THIS FILE IS COPIED: EDIT THE SOURCE FILE:\n" - + ":page-source: " + root.relativize(file.toPath()); - text = Pattern.compile("^(= .+)$", Pattern.MULTILINE).matcher(text).replaceAll(rep); - updateResource(root.resolve("docs/components/modules/others/pages"), file.getName(), text); - } - } catch (IOException e) { - throw new MojoExecutionException("Error reading file " + file + " Reason: " + e, e); - } - } } } } @@ -339,23 +317,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { } } - if (updated || exists) { - try { - // if we run in camel-core project then add additional meta-data - File rootFile = findCamelDirectory(project.getBasedir(), "core/camel-core"); - if (rootFile != null) { - Path root = rootFile.toPath().getParent().getParent(); - String text = PackageHelper.loadText(file); - String rep = "$1\n" - + "//THIS FILE IS COPIED: EDIT THE SOURCE FILE:\n" - + ":page-source: " + root.relativize(file.toPath()); - text = Pattern.compile("^(= .+)$", Pattern.MULTILINE).matcher(text).replaceAll(rep); - updateResource(root.resolve("docs/components/modules/dataformats/pages"), file.getName(), text); - } - } catch (IOException e) { - throw new MojoExecutionException("Error reading file " + file + " Reason: " + e, e); - } - } } } } @@ -393,25 +354,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { } LanguageModel model = JsonMapper.generateLanguageModel(json); - // skip option named id - model.getOptions().removeIf( - opt -> Objects.equals(opt.getName(), "id") || Objects.equals(opt.getName(), "expression")); - // enhanced for autowired - model.getOptions().stream().filter(BaseOptionModel::isAutowired).forEach(option -> { - option.setDescription("*Autowired* " + option.getDescription()); - }); - // enhance description for deprecated options - model.getOptions().stream().filter(BaseOptionModel::isDeprecated).forEach(option -> { - String desc = "*Deprecated* " + option.getDescription(); - if (!Strings.isEmpty(option.getDeprecationNote())) { - desc = option.getDescription(); - if (!desc.endsWith(".")) { - desc = desc + "."; - } - desc += " Deprecation note: " + option.getDeprecationNote(); - } - option.setDescription(desc); - }); boolean updated = updateHeader(languageName, file, model, " Language", kind); checkSince(file, model); @@ -435,16 +377,16 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { } private void executeEips() throws MojoExecutionException { - // only run if in camel-core-model + // only run if in camel-core-engine String currentDir = Paths.get(".").normalize().toAbsolutePath().toString(); - if (!currentDir.endsWith("camel-core-model")) { + if (!currentDir.endsWith("camel-core-engine")) { return; } final Set<File> jsonFiles = new TreeSet<>(); // find all json files in camel-core - File coreDir = new File("."); + File coreDir = new File("./../camel-core-model"); if (coreDir.isDirectory()) { File target = new File(coreDir, "target/classes/org/apache/camel/model"); PackageHelper.findJsonFiles(target, jsonFiles); @@ -457,35 +399,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { String json = loadEipJson(jsonFile); if (json != null) { EipModel model = JsonMapper.generateEipModel(json); - // skip option named id/description/expression/outputs - model.getOptions() - .removeIf(option -> "id".equals(option.getName()) || "description".equals(option.getName()) - || "expression".equals(option.getName()) - || "outputs".equals(option.getName())); - // lets put autowired in the description - model.getOptions().stream().filter(EipOptionModel::isAutowired).forEach(option -> { - String desc = "*Autowired* " + option.getDescription(); - option.setDescription(desc); - }); - // lets put required in the description - model.getOptions().stream().filter(EipOptionModel::isRequired).forEach(option -> { - String desc = "*Required* " + option.getDescription(); - option.setDescription(desc); - }); - // is the option deprecated then include that as well in the - // description - model.getOptions().stream().filter(EipOptionModel::isDeprecated).forEach(option -> { - String desc = "*Deprecated* " + option.getDescription(); - if (!Strings.isEmpty(option.getDeprecationNote())) { - if (!desc.endsWith(".")) { - desc += "."; - } - desc = desc + " Deprecation note: " + option.getDeprecationNote(); - } - option.setDescription(desc); - }); - - String eipName = model.getName(); // we only want actual EIPs from the models final String kind = "eip"; @@ -493,6 +406,8 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { continue; } + String eipName = model.getName(); + File file = new File(eipDocDir, eipName + "-" + kind + ".adoc"); boolean exists = file.exists(); @@ -593,6 +508,8 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { } newLines.add("= " + title); newLines.add(":docTitle: " + model.getTitle()); + String shortName = "mail".equals(name) ? "imap" : name; + newLines.add(":shortName: " + shortName); if (model instanceof ArtifactModel<?>) { newLines.add(":artifactId: " + ((ArtifactModel<?>) model).getArtifactId()); @@ -854,37 +771,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { private ComponentModel generateComponentModel(String json) { ComponentModel component = JsonMapper.generateComponentModel(json); - Stream.concat(component.getComponentOptions().stream(), component.getEndpointOptions().stream()) - .filter(BaseOptionModel::isAutowired).forEach(option -> { - String desc = "*Autowired* " + option.getDescription(); - option.setDescription(desc); - }); - Stream.concat(component.getComponentOptions().stream(), component.getEndpointOptions().stream()) - .filter(BaseOptionModel::isRequired).forEach(option -> { - String desc = "*Required* " + option.getDescription(); - option.setDescription(desc); - }); - Stream.concat(component.getComponentOptions().stream(), component.getEndpointOptions().stream()) - .filter(BaseOptionModel::isDeprecated).forEach(option -> { - String desc = "*Deprecated* " + option.getDescription(); - if (!Strings.isEmpty(option.getDeprecationNote())) { - if (!desc.endsWith(".")) { - desc += "."; - } - desc = desc + " Deprecation note: " + option.getDeprecationNote(); - } - option.setDescription(desc); - }); - Stream.concat(component.getComponentOptions().stream(), component.getEndpointOptions().stream()) - .filter(o -> o.getEnums() != null).forEach(option -> { - String desc = option.getDescription(); - if (!desc.endsWith(".")) { - desc = desc + "."; - } - desc = desc + " There are " + option.getEnums().size() + " enums and the value can be one of: " - + wrapEnumValues(option.getEnums()); - option.setDescription(desc); - }); return component; } @@ -895,33 +781,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo { private DataFormatModel generateDataFormatModel(String json) { DataFormatModel model = JsonMapper.generateDataFormatModel(json); - // skip option named id - model.getOptions().removeIf(opt -> Objects.equals(opt.getName(), "id")); - model.getOptions().stream().filter(BaseOptionModel::isAutowired).forEach(option -> { - String desc = "*Autowired* " + option.getDescription(); - option.setDescription(desc); - }); - // enhance description for deprecated options - model.getOptions().stream().filter(BaseOptionModel::isDeprecated).forEach(option -> { - String desc = "*Deprecated* " + option.getDescription(); - if (!Strings.isEmpty(option.getDeprecationNote())) { - desc = option.getDescription(); - if (!desc.endsWith(".")) { - desc = desc + "."; - } - desc += " Deprecation note: " + option.getDeprecationNote(); - } - option.setDescription(desc); - }); - model.getOptions().stream().filter(o -> o.getEnums() != null).forEach(option -> { - String desc = option.getDescription(); - if (!desc.endsWith(".")) { - desc = desc + "."; - } - desc = desc + " There are " + option.getEnums().size() + " enums and the value can be one of: " - + wrapEnumValues(option.getEnums()); - option.setDescription(desc); - }); return model; } diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel index 8cf77b2..220e84d 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-options.mvel @@ -1,15 +1,2 @@ -== Component Options - -@if{componentOptions.isEmpty()} -The @{title} component has no options. -@else{} -The @{title} component supports @{componentOptions.size()} options, which are listed below. -@end{} - -@if{!componentOptions.isEmpty()} -[width="100%",cols="2,5,^1,2",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Description | Default | Type -@foreach{row : componentOptions}| *@{row.getShortName(30)}* (@{row.shortGroup}) @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()} -@end{}|=== -@end{} +include::partial$component-configure-options.adoc[] +include::partial$component-endpoint-options.adoc[] diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-options.mvel index 3c0f970..6a2c796 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-options.mvel +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-options.mvel @@ -1,13 +1 @@ -@if{options.isEmpty()} -The @{title} dataformat has no options. -@else{} -The @{title} dataformat supports @{options.size()} options, which are listed below. -@end{} - -@if{!options.isEmpty()} -[width="100%",cols="2s,1m,1m,6",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Default | Java Type | Description -@foreach{row : options}| @{row.name} | @{row.getShortDefaultValue(20)} | @{row.shortJavaType} @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} -@end{}|=== -@end{} \ No newline at end of file +include::partial$dataformat-options.adoc[] \ No newline at end of file diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/eip-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/eip-options.mvel index 7f9a3c4..4a7cc05 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/eip-options.mvel +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/eip-options.mvel @@ -1,11 +1 @@ -@if{options.isEmpty()} -The @{title} EIP has no options. -@else{} -The @{title} EIP supports @{options.size()} options which are listed below: - -[width="100%",cols="2,5,^1,2",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Description | Default | Type -@foreach{row : options}| *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()} -@end{}|=== -@end{} \ No newline at end of file +include::partial$eip-options.adoc[] \ No newline at end of file diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel deleted file mode 100644 index 5c40186..0000000 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel +++ /dev/null @@ -1,113 +0,0 @@ -== Endpoint Options - -The @{title} endpoint is configured using URI syntax: - ----- -@{syntax} ----- - -with the following path and query parameters: - -=== Path Parameters (@{endpointPathOptions.size()} parameters): - -@if{endpointPathOptions.isEmpty()} -The @{title} endpoint has no path parameters. -@else{} -[width="100%",cols="2,5,^1,2",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Description | Default | Type -@foreach{row : endpointPathOptions}| *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()} -@end{}|=== -@end{} - -=== Query Parameters (@{endpointParameterOptions.size()} parameters): - -@if{endpointParameterOptions.isEmpty()} -The @{title} endpoint has no query parameters. -@else{} -[width="100%",cols="2,5,^1,2",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Description | Default | Type -@foreach{row : endpointParameterOptions}| *@{row.getShortName(30)}* (@{row.shortGroup}) @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} | @{row.getShortDefaultValue(20)} | @{row.getShortJavaType()} -@end{}|=== -@end{} - -@if{!apiOptions.isEmpty()} - -=== API Parameters (@{apiOptions.size()} APIs): - -The @{title} endpoint is an API based component and has additional parameters based on which API name and API method is used. -The API name and API method is located in the endpoint URI as the @{apiSyntax} path parameters: - ----- -@{syntax} ----- - -There are @{apiOptions.size} API names as listed in the table below: - -[width="100%",cols="2,2,6",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| API Name | Type | Description -@foreach{api : apiOptions}| *@{api.name}* | @{util.producerOrConsumer(api)} | @{api.description} -@end{}|=== - -Each API is documented in the following sections to come. - -@foreach{api : apiOptions} -==== API: @{api.name} -@if{api.consumerOnly} -*Only consumer is supported* -@elseif{api.producerOnly} -*Only producer is supported* -@else{} -*Both producer and consumer are supported* -@end{} - -@if{api.methods.isEmpty()} -The @{api.name} has no API methods. -@else{} - -The @{api.name} API has @{api.methods.size} method(s) which is represented by the following method signatures -(an API method may have multiple signatures due to overloading): - -[source,java] ----- -@foreach{method : api.methods}@foreach{signature : method.signatures} -@{util.formatSignature(signature)} -@end{}@end{} ----- - -The @{api.name} API is defined in the syntax as follows: - ----- -@{scheme}:${api.name}/methodName?[parameters] ----- - -The @{api.methods.size} method(s) is listed in the table below. -(API methods can have a shorthand alias name which can be used in the syntax instead of the name) - -[width="100%",cols="2,2,6",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Method | Alias | Description -@foreach{method : api.methods}| *@{method.name}* | @{util.apiMethodAlias(api, method)} | @{method.description} -@end{}|=== - -The @{api.name} API method(s) has the following set of parameters listed in the table below: -[width="100%",cols="2,2,4,2",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Method | Parameter | Description | Type -@foreach{method : api.methods}@foreach{row : method.options}| @{method.name} | *@{row.getShortName(30)}* @{row.description.?contains("\n") ? "a" : ""}| @{row.optional ? "*Optional* " : ""} @{util.escape(row.description)} | @{row.getShortJavaType()} -@end{}@end{}|=== - -In addition to the parameters above, the @{api.name} API can also use from the @{endpointParameterOptions.size()} endpoint query option -which is listed in the _Query Parameters_ section. - -Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. -The message header name must be of the format `Camel@{util.componentName(scheme)}.parameter`. -The `inBody` parameter overrides message header, i.e. the endpoint parameter `inBody=myParameterNameHere` -would override a `Camel@{util.componentName(scheme)}.myParameterNameHere` header. - -@end{} -@end{} - -@end{} diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel index 06cc787..67c3942 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel @@ -1,13 +1 @@ -@if{options.isEmpty()} -The @{title} language has no options. -@else{} -The @{title} language supports @{options.size()} options, which are listed below. -@end{} - -@if{!options.isEmpty()} -[width="100%",cols="2,1m,1m,6",options="header"] -|===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| Name | Default | Java Type | Description -@foreach{row : options}| @{row.name} | @{row.getShortDefaultValue(20)} | @{row.shortJavaType} @{row.description.?contains("\n") ? "a" : ""}| @{util.escape(row.description)} -@end{}|=== -@end{} \ No newline at end of file +include::partial$language-options.adoc[] \ No newline at end of file