This is an automated email from the ASF dual-hosted git repository. djencks pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git
commit 281fc53d7a65455dafffec7bc2170aff22a1922b Author: David Jencks <djen...@apache.org> AuthorDate: Wed Nov 3 20:42:12 2021 -0700 remove adoc generation code and templates --- .../CamelKafkaConnectorKameletUpdateMojo.java | 60 ---------------- .../maven/CamelKafkaConnectorUpdateMojo.java | 61 ---------------- .../camel-kafka-connector-sink-options.mvel | 82 ---------------------- .../camel-kafka-connector-source-options.mvel | 82 ---------------------- 4 files changed, 285 deletions(-) diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java index b715f42..7a719f1 100644 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java +++ b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorKameletUpdateMojo.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -58,7 +57,6 @@ import org.apache.camel.kafkaconnector.maven.utils.MavenUtils; import org.apache.camel.kafkaconnector.maven.utils.YamlKameletMapper; import org.apache.camel.kafkaconnector.model.CamelKafkaConnectorModel; import org.apache.camel.kafkaconnector.model.CamelKafkaConnectorOptionModel; -import org.apache.camel.maven.packaging.MvelHelper; import org.apache.camel.tooling.util.Strings; import org.apache.camel.tooling.util.srcgen.JavaClass; import org.apache.camel.tooling.util.srcgen.Method; @@ -542,28 +540,6 @@ public class CamelKafkaConnectorKameletUpdateMojo extends AbstractCamelKameletKa throw new MojoExecutionException("Error processing mvel examples properties template. Reason: " + e, e); } - // Generate documentation in src/main/docs and - // docs/modules/ROOT/pages/reference/connectors - File docFolder = new File(connectorDir, "src/main/docs/"); - File docFile = new File(docFolder, getMainDepArtifactId() + "-kafka-" + ct.name().toLowerCase() + "-connector.adoc"); - File docFolderWebsite = new File(projectBaseDir, "docs/modules/ROOT/pages/reference/connectors/"); - File docFileWebsite = new File(docFolderWebsite, getMainDepArtifactId() + "-kafka-" + ct.name().toLowerCase() + "-connector.adoc"); - String changed = templateAutoConfigurationOptions(listOptions, kamelet.getDescription(), connectorDir, ct, packageName + "." + javaClassConnectorName, convertersList, - transformsList, aggregationStrategiesList); - - boolean updated = updateAutoConfigureOptions(docFile, changed); - if (updated) { - getLog().info("Updated doc file: " + docFile); - } else { - getLog().debug("No changes to doc file: " + docFile); - } - boolean updatedWebsite = updateAutoConfigureOptions(docFileWebsite, changed); - if (updatedWebsite) { - getLog().info("Updated website doc file: " + docFileWebsite); - } else { - getLog().debug("No changes to website doc file: " + docFileWebsite); - } - // generate json descriptor src/generated/resources/<connector-name>.json writeJson(listOptions, kamelet.getDescription(), connectorDir, ct, packageName + "." + javaClassConnectorName, convertersList, transformsList, aggregationStrategiesList); // generate descriptor src/generated/descriptors/connector-{sink,source}.properties @@ -661,42 +637,6 @@ public class CamelKafkaConnectorKameletUpdateMojo extends AbstractCamelKameletKa listOptions.add(optionModel); } - private String templateAutoConfigurationOptions(List<CamelKafkaConnectorOptionModel> options, String componentDescription, File connectorDir, ConnectorType ct, String connectorClass, - List<String> convertersList, List<String> transformsList, List<String> aggregationStrategiesList) - throws MojoExecutionException { - - CamelKafkaConnectorModel model = new CamelKafkaConnectorModel(); - model.setOptions(options); - model.setArtifactId(getMainDepArtifactId()); - model.setGroupId(getMainDepGroupId()); - model.setVersion(getMainDepVersion()); - model.setConnectorClass(connectorClass); - model.setConverters(convertersList); - model.setTransforms(transformsList); - model.setAggregationStrategies(aggregationStrategiesList); - model.setDescription(componentDescription); - if (getMainDepArtifactId().equalsIgnoreCase("camel-coap+tcp")) { - model.setTitle("camel-coap-tcp"); - } else if (getMainDepArtifactId().equalsIgnoreCase("camel-coaps+tcp")) { - model.setTitle("camel-coaps-tcp"); - } else { - model.setTitle(getMainDepArtifactId()); - } - - try { - String template = null; - if (ct.name().equals(ConnectorType.SINK.name())) { - template = loadText(CamelKafkaConnectorKameletUpdateMojo.class.getClassLoader().getResourceAsStream("camel-kafka-connector-sink-options.mvel")); - } else if (ct.name().equals(ConnectorType.SOURCE.name())) { - template = loadText(CamelKafkaConnectorKameletUpdateMojo.class.getClassLoader().getResourceAsStream("camel-kafka-connector-source-options.mvel")); - } - String out = (String)TemplateRuntime.eval(template, model, Collections.singletonMap("util", MvelHelper.INSTANCE)); - return out; - } catch (Exception e) { - throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e); - } - } - private void writeJson(List<CamelKafkaConnectorOptionModel> options, String componentDescription, File connectorDir, ConnectorType ct, String connectorClass, List<String> convertersList, List<String> transformsList, List<String> aggregationStrategiesList) throws MojoExecutionException { diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorUpdateMojo.java b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorUpdateMojo.java index 5d946f5..e53edd1 100644 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorUpdateMojo.java +++ b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/java/org/apache/camel/kafkaconnector/maven/CamelKafkaConnectorUpdateMojo.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -55,7 +54,6 @@ import org.apache.camel.kafkaconnector.maven.utils.JsonMapperKafkaConnector; import org.apache.camel.kafkaconnector.maven.utils.MavenUtils; import org.apache.camel.kafkaconnector.model.CamelKafkaConnectorModel; import org.apache.camel.kafkaconnector.model.CamelKafkaConnectorOptionModel; -import org.apache.camel.maven.packaging.MvelHelper; import org.apache.camel.tooling.model.BaseOptionModel; import org.apache.camel.tooling.model.ComponentModel; import org.apache.camel.tooling.model.JsonMapper; @@ -562,29 +560,6 @@ public class CamelKafkaConnectorUpdateMojo extends AbstractCamelComponentKafkaCo throw new MojoExecutionException("Error processing mvel examples properties template. Reason: " + e, e); } - // Generate documentation in src/main/docs and - // docs/modules/ROOT/pages/reference/connectors - File docFolder = new File(connectorDir, "src/main/docs/"); - File docFile = new File(docFolder, getMainDepArtifactId() + "-kafka-" + ct.name().toLowerCase() + "-connector.adoc"); - File docFolderWebsite = new File(projectBaseDir, "docs/modules/ROOT/pages/reference/connectors/"); - File docFileWebsite = new File(docFolderWebsite, getMainDepArtifactId() + "-kafka-" + ct.name().toLowerCase() + "-connector.adoc"); - String changed = templateAutoConfigurationOptions(listOptions, model.getDescription(), connectorDir, ct, packageName + "." + javaClassConnectorName, convertersList, - transformsList, aggregationStrategiesList); - - - boolean updated = updateAutoConfigureOptions(docFile, changed); - if (updated) { - getLog().info("Updated doc file: " + docFile); - } else { - getLog().debug("No changes to doc file: " + docFile); - } - boolean updatedWebsite = updateAutoConfigureOptions(docFileWebsite, changed); - if (updatedWebsite) { - getLog().info("Updated website doc file: " + docFileWebsite); - } else { - getLog().debug("No changes to website doc file: " + docFileWebsite); - } - // generate json descriptor src/generated/resources/<connector-name>.json writeJson(listOptions, model.getDescription(), connectorDir, ct, packageName + "." + javaClassConnectorName, convertersList, transformsList, aggregationStrategiesList); // generate descriptor src/generated/descriptors/connector-{sink,source}.properties @@ -685,42 +660,6 @@ public class CamelKafkaConnectorUpdateMojo extends AbstractCamelComponentKafkaCo listOptions.add(optionModel); } - private String templateAutoConfigurationOptions(List<CamelKafkaConnectorOptionModel> options, String componentDescription, File connectorDir, ConnectorType ct, String connectorClass, - List<String> convertersList, List<String> transformsList, List<String> aggregationStrategiesList) - throws MojoExecutionException { - - CamelKafkaConnectorModel model = new CamelKafkaConnectorModel(); - model.setOptions(options); - model.setArtifactId(getMainDepArtifactId()); - model.setGroupId(getMainDepGroupId()); - model.setVersion(getMainDepVersion()); - model.setConnectorClass(connectorClass); - model.setConverters(convertersList); - model.setTransforms(transformsList); - model.setAggregationStrategies(aggregationStrategiesList); - model.setDescription(componentDescription); - if (getMainDepArtifactId().equalsIgnoreCase("camel-coap+tcp")) { - model.setTitle("camel-coap-tcp"); - } else if (getMainDepArtifactId().equalsIgnoreCase("camel-coaps+tcp")) { - model.setTitle("camel-coaps-tcp"); - } else { - model.setTitle(getMainDepArtifactId()); - } - - try { - String template = null; - if (ct.name().equals(ConnectorType.SINK.name())) { - template = loadText(CamelKafkaConnectorUpdateMojo.class.getClassLoader().getResourceAsStream("camel-kafka-connector-sink-options.mvel")); - } else if (ct.name().equals(ConnectorType.SOURCE.name())) { - template = loadText(CamelKafkaConnectorUpdateMojo.class.getClassLoader().getResourceAsStream("camel-kafka-connector-source-options.mvel")); - } - String out = (String)TemplateRuntime.eval(template, model, Collections.singletonMap("util", MvelHelper.INSTANCE)); - return out; - } catch (Exception e) { - throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e); - } - } - private void writeJson(List<CamelKafkaConnectorOptionModel> options, String componentDescription, File connectorDir, ConnectorType ct, String connectorClass, List<String> convertersList, List<String> transformsList, List<String> aggregationStrategiesList) throws MojoExecutionException { diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-sink-options.mvel b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-sink-options.mvel deleted file mode 100644 index 75cfed1..0000000 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-sink-options.mvel +++ /dev/null @@ -1,82 +0,0 @@ -[[@{title}-kafka-connector-sink]] -= @{title}-kafka-connector sink configuration - -Connector Description: @{description} - -When using @{title}-kafka-connector as sink make sure to use the following Maven dependency to have support for the connector: - -[source,xml] ----- -<dependency> - <groupId>@{groupId}.kafkaconnector</groupId> - <artifactId>@{artifactId}-kafka-connector</artifactId> - <version>x.x.x</version> - <!-- use the same version as your Camel Kafka connector version --> -</dependency> ----- - -To use this Sink connector in Kafka connect you'll need to set the following connector.class - -[source,java] ----- -connector.class=@{connectorClass} ----- - -@if{options.isEmpty()} -The @{title} sink connector has no options. -@else{} -The @{title} sink connector supports @{options.size()} options, which are listed below. -@end{} - -@if{!options.isEmpty()} -[width="100%",cols="2,5,^1,1,1",options="header"] -|=== -| Name | Description | Default | Required | Priority -@foreach{row : options}| *@{row.getShortName(50)}* | @{util.escape(row.description)} | @{row.defaultValue == "ConfigDef.NO_DEFAULT_VALUE" ? "none" : row.defaultValue} | @{row.required} | @{row.priority} -@end{}|=== -@end{} - -@if{converters.isEmpty()} -The @{title} sink connector has no converters out of the box. -@else{} -The @{title} sink connector supports @{converters.size()} converters out of the box, which are listed below. -@end{} - -@if{!converters.isEmpty()} -[source,java] ----- -@foreach{row : converters} -@{row} -@end{} ----- -@end{} - -@if{transforms.isEmpty()} -The @{title} sink connector has no transforms out of the box. -@else{} -The @{title} sink connector supports @{transforms.size()} transforms out of the box, which are listed below. -@end{} - -@if{!transforms.isEmpty()} -[source,java] ----- -@foreach{row : transforms} -@{row} -@end{} ----- -@end{} - -@if{aggregationStrategies.isEmpty()} -The @{title} sink connector has no aggregation strategies out of the box. -@else{} -The @{title} sink connector supports @{aggregationStrategies.size()} aggregation strategies out of the box, which are listed below. -@end{} - -@if{!aggregationStrategies.isEmpty()} -[source,java] ----- -@foreach{row : aggregationStrategies} -@{row} -@end{} ----- -@end{} diff --git a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-source-options.mvel b/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-source-options.mvel deleted file mode 100644 index 06afc23..0000000 --- a/tooling/camel-kafka-connector-generator-maven-plugin/src/main/resources/camel-kafka-connector-source-options.mvel +++ /dev/null @@ -1,82 +0,0 @@ -[[@{title}-kafka-connector-source]] -= @{title}-kafka-connector source configuration - -Connector description: @{description} - -When using @{title}-kafka-connector as source make sure to use the following Maven dependency to have support for the connector: - -[source,xml] ----- -<dependency> - <groupId>@{groupId}.kafkaconnector</groupId> - <artifactId>@{artifactId}-kafka-connector</artifactId> - <version>x.x.x</version> - <!-- use the same version as your Camel Kafka connector version --> -</dependency> ----- - -To use this Source connector in Kafka connect you'll need to set the following connector.class - -[source,java] ----- -connector.class=@{connectorClass} ----- - -@if{options.isEmpty()} -The @{title} source connector has no options. -@else{} -The @{title} source connector supports @{options.size()} options, which are listed below. -@end{} - -@if{!options.isEmpty()} -[width="100%",cols="2,5,^1,1,1",options="header"] -|=== -| Name | Description | Default | Required | Priority -@foreach{row : options}| *@{row.getShortName(50)}* | @{util.escape(row.description)} | @{row.defaultValue == "ConfigDef.NO_DEFAULT_VALUE" ? "none" : row.defaultValue} | @{row.required} | @{row.priority} -@end{}|=== -@end{} - -@if{converters.isEmpty()} -The @{title} source connector has no converters out of the box. -@else{} -The @{title} source connector supports @{converters.size()} converters out of the box, which are listed below. -@end{} - -@if{!converters.isEmpty()} -[source,java] ----- -@foreach{row : converters} -@{row} -@end{} ----- -@end{} - -@if{transforms.isEmpty()} -The @{title} source connector has no transforms out of the box. -@else{} -The @{title} source connector supports @{transforms.size()} transforms out of the box, which are listed below. -@end{} - -@if{!transforms.isEmpty()} -[source,java] ----- -@foreach{row : transforms} -@{row} -@end{} ----- -@end{} - -@if{aggregationStrategies.isEmpty()} -The @{title} source connector has no aggregation strategies out of the box. -@else{} -The @{title} source connector supports @{aggregationStrategies.size()} aggregation strategies out of the box, which are listed below. -@end{} - -@if{!aggregationStrategies.isEmpty()} -[source,java] ----- -@foreach{row : aggregationStrategies} -@{row} -@end{} ----- -@end{}