This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 69ab601560 Fix generated AsciiDoc id headings 69ab601560 is described below commit 69ab601560da76905f2b0c5a4ce79717ab34faf0 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Wed Sep 21 07:49:09 2022 +0100 Fix generated AsciiDoc id headings --- .../ROOT/pages/reference/extensions/activemq.adoc | 3 ++- .../ROOT/pages/reference/extensions/amqp.adoc | 3 ++- .../pages/reference/extensions/aws2-lambda.adoc | 2 +- .../reference/extensions/azure-eventhubs.adoc | 2 +- .../reference/extensions/azure-storage-blob.adoc | 2 +- .../extensions/azure-storage-datalake.adoc | 2 +- .../reference/extensions/azure-storage-queue.adoc | 2 +- .../pages/reference/extensions/bean-validator.adoc | 3 ++- .../pages/reference/extensions/cassandraql.adoc | 2 +- .../ROOT/pages/reference/extensions/core.adoc | 6 +++++- .../pages/reference/extensions/freemarker.adoc | 2 +- .../ROOT/pages/reference/extensions/gson.adoc | 2 +- .../pages/reference/extensions/infinispan.adoc | 3 ++- .../ROOT/pages/reference/extensions/jackson.adoc | 5 ++++- .../ROOT/pages/reference/extensions/jaxb.adoc | 2 +- .../ROOT/pages/reference/extensions/jdbc.adoc | 3 ++- .../ROOT/pages/reference/extensions/jms.adoc | 3 ++- .../ROOT/pages/reference/extensions/jpa.adoc | 1 + .../ROOT/pages/reference/extensions/jq.adoc | 2 +- .../ROOT/pages/reference/extensions/jslt.adoc | 3 ++- .../ROOT/pages/reference/extensions/kafka.adoc | 2 +- .../ROOT/pages/reference/extensions/kamelet.adoc | 3 ++- .../reference/extensions/microprofile-health.adoc | 3 +++ .../reference/extensions/microprofile-metrics.adoc | 2 ++ .../pages/reference/extensions/platform-http.adoc | 8 ++++++-- .../ROOT/pages/reference/extensions/protobuf.adoc | 3 ++- .../ROOT/pages/reference/extensions/quartz.adoc | 2 +- .../ROOT/pages/reference/extensions/qute.adoc | 2 +- .../pages/reference/extensions/salesforce.adoc | 2 +- .../ROOT/pages/reference/extensions/sjms.adoc | 3 ++- .../ROOT/pages/reference/extensions/sjms2.adoc | 3 ++- .../ROOT/pages/reference/extensions/sql.adoc | 5 ++++- .../ROOT/pages/reference/extensions/velocity.adoc | 2 +- .../reference/extensions/vertx-websocket.adoc | 5 +++-- .../ROOT/pages/reference/extensions/xslt.adoc | 2 ++ .../quarkus/maven/UpdateExtensionDocPageMojo.java | 19 ++++++++++++------- .../quarkus/maven/processor/AsciiDocFile.java | 8 +++++++- .../maven/processor/SectionIdPostProcessor.java | 22 ++++++++++------------ 38 files changed, 96 insertions(+), 53 deletions(-) diff --git a/docs/modules/ROOT/pages/reference/extensions/activemq.adoc b/docs/modules/ROOT/pages/reference/extensions/activemq.adoc index 504f5c5b44..f9689264c8 100644 --- a/docs/modules/ROOT/pages/reference/extensions/activemq.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/activemq.adoc @@ -47,12 +47,13 @@ endif::[] [id="extensions-activemq-usage"] == Usage -[id="extensions-usage-message-mapping-with-org-w3c-dom-node"] +[id="extensions-activemq-usage-message-mapping-with-org-w3c-dom-node"] === Message mapping with `org.w3c.dom.Node` The Camel ActiveMQ component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, you must ensure that the `camel-quarkus-jaxp` extension is present on the classpath. +[id="extensions-activemq-usage-native-mode-support-for-javax-jms-objectmessage"] === Native mode support for javax.jms.ObjectMessage When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. diff --git a/docs/modules/ROOT/pages/reference/extensions/amqp.adoc b/docs/modules/ROOT/pages/reference/extensions/amqp.adoc index e55f91c58f..6b74401fe8 100644 --- a/docs/modules/ROOT/pages/reference/extensions/amqp.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/amqp.adoc @@ -47,12 +47,13 @@ endif::[] [id="extensions-amqp-usage"] == Usage -[id="extensions-usage-message-mapping-with-org-w3c-dom-node"] +[id="extensions-amqp-usage-message-mapping-with-org-w3c-dom-node"] === Message mapping with `org.w3c.dom.Node` The Camel AMQP component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, you must ensure that the `camel-quarkus-jaxp` extension is present on the classpath. +[id="extensions-amqp-usage-native-mode-support-for-javax-jms-objectmessage"] === Native mode support for javax.jms.ObjectMessage When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. diff --git a/docs/modules/ROOT/pages/reference/extensions/aws2-lambda.adoc b/docs/modules/ROOT/pages/reference/extensions/aws2-lambda.adoc index cf6f7e2f9e..ec4cdab1c8 100644 --- a/docs/modules/ROOT/pages/reference/extensions/aws2-lambda.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/aws2-lambda.adoc @@ -54,7 +54,7 @@ https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide]. [id="extensions-aws2-lambda-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-not-possible-to-leverage-quarkus-amazon-lambda-by-camel-aws2-lambda-extension"] +[id="extensions-aws2-lambda-configuration-not-possible-to-leverage-quarkus-amazon-lambda-by-camel-aws2-lambda-extension"] === Not possible to leverage quarkus-amazon-lambda by Camel aws2-lambda extension Quarkus-amazon-lambda extension allows you to use Quarkus to build your AWS Lambdas, whereas Camel component manages (deploy, undeploy, …) existing functions. diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-eventhubs.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-eventhubs.adoc index e3343c7427..fbf1fb03b7 100644 --- a/docs/modules/ROOT/pages/reference/extensions/azure-eventhubs.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/azure-eventhubs.adoc @@ -46,7 +46,7 @@ endif::[] [id="extensions-azure-eventhubs-usage"] == Usage -[id="extensions-usage-micrometer-metrics-support"] +[id="extensions-azure-eventhubs-usage-micrometer-metrics-support"] === Micrometer metrics support If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on `quarkus-micrometer` to ensure diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc index a44d5445c7..b855f211ed 100644 --- a/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/azure-storage-blob.adoc @@ -46,7 +46,7 @@ endif::[] [id="extensions-azure-storage-blob-usage"] == Usage -[id="extensions-usage-micrometer-metrics-support"] +[id="extensions-azure-storage-blob-usage-micrometer-metrics-support"] === Micrometer metrics support If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on `quarkus-micrometer` to ensure diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-storage-datalake.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-storage-datalake.adoc index 5dc8d7080c..25f6dc3dec 100644 --- a/docs/modules/ROOT/pages/reference/extensions/azure-storage-datalake.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/azure-storage-datalake.adoc @@ -42,7 +42,7 @@ endif::[] [id="extensions-azure-storage-datalake-usage"] == Usage -[id="extensions-usage-micrometer-metrics-support"] +[id="extensions-azure-storage-datalake-usage-micrometer-metrics-support"] === Micrometer metrics support If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on `quarkus-micrometer` to ensure diff --git a/docs/modules/ROOT/pages/reference/extensions/azure-storage-queue.adoc b/docs/modules/ROOT/pages/reference/extensions/azure-storage-queue.adoc index 9676a6d812..036465d1f6 100644 --- a/docs/modules/ROOT/pages/reference/extensions/azure-storage-queue.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/azure-storage-queue.adoc @@ -46,7 +46,7 @@ endif::[] [id="extensions-azure-storage-queue-usage"] == Usage -[id="extensions-usage-micrometer-metrics-support"] +[id="extensions-azure-storage-queue-usage-micrometer-metrics-support"] === Micrometer metrics support If you wish to enable the collection of Micrometer metrics for the Reactor Netty transports, then you should declare a dependency on `quarkus-micrometer` to ensure diff --git a/docs/modules/ROOT/pages/reference/extensions/bean-validator.adoc b/docs/modules/ROOT/pages/reference/extensions/bean-validator.adoc index 71d68756a2..54a9122711 100644 --- a/docs/modules/ROOT/pages/reference/extensions/bean-validator.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/bean-validator.adoc @@ -47,7 +47,7 @@ endif::[] [id="extensions-bean-validator-usage"] == Usage -[id="extensions-usage-configuring-the-validatorfactory"] +[id="extensions-bean-validator-usage-configuring-the-validatorfactory"] === Configuring the ValidatorFactory Implementation of this extension leverages the https://quarkus.io/guides/validation[Quarkus Hibernate Validator extension]. @@ -57,6 +57,7 @@ Therefore it is not possible to configure the `ValidatorFactory` by Camel's prop You can configure the `ValidatorFactory` by the creation of beans which will be injected into the default `ValidatorFactory` (created by Quarkus). See the https://quarkus.io/guides/validation#hibernate-validator-extension-and-cdi[Quarkus CDI documentation] for more information. +[id="extensions-bean-validator-usage-custom-validation-groups-in-native-mode"] === Custom validation groups in native mode When using custom validation groups in native mode, all the interfaces need to be registered for reflection (see the https://quarkus.io/guides/writing-native-applications-tips#register-reflection[documentation]). diff --git a/docs/modules/ROOT/pages/reference/extensions/cassandraql.adoc b/docs/modules/ROOT/pages/reference/extensions/cassandraql.adoc index ecb24dde7e..5d60003646 100644 --- a/docs/modules/ROOT/pages/reference/extensions/cassandraql.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/cassandraql.adoc @@ -48,7 +48,7 @@ endif::[] [id="extensions-cassandraql-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-cassandra-aggregation-repository-in-native-mode"] +[id="extensions-cassandraql-configuration-cassandra-aggregation-repository-in-native-mode"] === Cassandra aggregation repository in native mode In order to use Cassandra aggregation repositories like `CassandraAggregationRepository` in native mode, you must xref:extensions/core.adoc#quarkus.camel.native.reflection.serialization-enabled[enable native serialization support]. diff --git a/docs/modules/ROOT/pages/reference/extensions/core.adoc b/docs/modules/ROOT/pages/reference/extensions/core.adoc index 158ed84edd..ac589e15b9 100644 --- a/docs/modules/ROOT/pages/reference/extensions/core.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/core.adoc @@ -54,9 +54,10 @@ endif::[] [id="extensions-core-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-simple-language"] +[id="extensions-core-configuration-simple-language"] === Simple language +[id="extensions-core-configuration-using-the-ognl-notation"] ==== Using the OGNL notation When using the OGNL notation from the simple language, the `camel-quarkus-bean` extension should be used. @@ -70,6 +71,7 @@ In such a situation, one should take an additional dependency on the camel-quark Note that in native mode, some classes may need to be registered for reflection. In the example above, the `Client` class needs to be link:https://quarkus.io/guides/writing-native-applications-tips#registering-for-reflection[registered for reflection]. +[id="extensions-core-configuration-using-dynamic-type-resolution-in-native-mode"] ==== Using dynamic type resolution in native mode When dynamically resolving a type from simple expressions like: @@ -88,6 +90,7 @@ simple("${body} is 'java.nio.ByteBuffer'") As such, the class `java.nio.ByteBuffer` needs to be link:https://quarkus.io/guides/writing-native-applications-tips#registering-for-reflection[registered for reflection]. +[id="extensions-core-configuration-using-the-simple-language-with-classpath-resources-in-native-mode"] ==== Using the simple language with classpath resources in native mode If your route is supposed to load a Simple script from classpath, like in the following example @@ -107,6 +110,7 @@ quarkus.native.resources.includes = mysimple.txt More information about selecting resources for inclusion in the native executable can be found at xref:user-guide/native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable]. +[id="extensions-core-configuration-configuring-a-custom-bean-via-properties-in-native-mode"] ==== Configuring a custom bean via properties in native mode When specifying a custom bean via properties in native mode with configuration like `#class:*` or `#type:*`, it may be needed to register some classes for reflection manually. diff --git a/docs/modules/ROOT/pages/reference/extensions/freemarker.adoc b/docs/modules/ROOT/pages/reference/extensions/freemarker.adoc index f89a8e84cf..15777dc866 100644 --- a/docs/modules/ROOT/pages/reference/extensions/freemarker.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/freemarker.adoc @@ -53,7 +53,7 @@ The `allowContextMapAll` option is not supported in native mode as it requires r [id="extensions-freemarker-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-quarkiverse-freemarker-and-its-configuration"] +[id="extensions-freemarker-configuration-quarkiverse-freemarker-and-its-configuration"] == Quarkiverse Freemarker and its configuration Camel Quarkus Freemarker uses dev/index.html[Quarkiverse Freemarker] under the hood. diff --git a/docs/modules/ROOT/pages/reference/extensions/gson.adoc b/docs/modules/ROOT/pages/reference/extensions/gson.adoc index 6e1e94e712..a5024aef4c 100644 --- a/docs/modules/ROOT/pages/reference/extensions/gson.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/gson.adoc @@ -48,7 +48,7 @@ endif::[] [id="extensions-gson-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-marshaling-unmarshaling-objects-in-native-mode"] +[id="extensions-gson-configuration-marshaling-unmarshaling-objects-in-native-mode"] === Marshaling/Unmarshaling objects in native mode When marshaling/unmarshaling objects in native mode, all the serialized classes need to be link:https://quarkus.io/guides/writing-native-applications-tips#registering-for-reflection[registered for reflection]. diff --git a/docs/modules/ROOT/pages/reference/extensions/infinispan.adoc b/docs/modules/ROOT/pages/reference/extensions/infinispan.adoc index c9d06e9d1d..20cfea3021 100644 --- a/docs/modules/ROOT/pages/reference/extensions/infinispan.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/infinispan.adoc @@ -48,12 +48,13 @@ endif::[] [id="extensions-infinispan-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-infinispan-client-configuration"] +[id="extensions-infinispan-configuration-infinispan-client-configuration"] === Infinispan Client Configuration You can either configure the Infinispan client via the relevant Camel Infinispan component & endpoint options, or you may use the https://quarkus.io/guides/infinispan-client#configuration-reference[Quarkus Infinispan extension configuration properties]. +[id="extensions-infinispan-configuration-camel-infinispan-infinispanremoteaggregationrepository-in-native-mode"] === Camel Infinispan `InfinispanRemoteAggregationRepository` in native mode If you chose to use the `InfinispanRemoteAggregationRepository` in native mode, then you must xref:extensions/core.adoc#quarkus.camel.native.reflection.serialization-enabled[enable native serialization support]. diff --git a/docs/modules/ROOT/pages/reference/extensions/jackson.adoc b/docs/modules/ROOT/pages/reference/extensions/jackson.adoc index 821f5091e9..88dbb6d20a 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jackson.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jackson.adoc @@ -47,16 +47,18 @@ endif::[] [id="extensions-jackson-usage"] == Usage -[id="extensions-usage-configuring-the-jackson-objectmapper"] +[id="extensions-jackson-usage-configuring-the-jackson-objectmapper"] === Configuring the Jackson `ObjectMapper` There are a few ways of configuring the `ObjectMapper` that the `JacksonDataFormat` uses. These are outlined below. +[id="extensions-jackson-usage-objectmapper-created-internally-by-jacksondataformat"] ==== `ObjectMapper` created internally by `JacksonDataFormat` By default, `JacksonDataFormat` will create its own `ObjectMapper` and use the various configuration options on the `DataFormat` to configure additional Jackson modules, pretty printing and other features. +[id="extensions-jackson-usage-custom-objectmapper-for-jacksondataformat"] ==== Custom `ObjectMapper` for `JacksonDataFormat` You can pass a custom `ObjectMapper` instance to `JacksonDataFormat` as follows. @@ -78,6 +80,7 @@ public class Routes extends RouteBuilder { } ---- +[id="extensions-jackson-usage-using-the-quarkus-jackson-objectmapper-with-jacksondataformat"] ==== Using the Quarkus Jackson `ObjectMapper` with `JacksonDataFormat` The Quarkus Jackson extension exposes an `ObjectMapper` CDI bean which can be discovered by the `JacksonDataFormat`. diff --git a/docs/modules/ROOT/pages/reference/extensions/jaxb.adoc b/docs/modules/ROOT/pages/reference/extensions/jaxb.adoc index 130d18e8b4..55525e6f20 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jaxb.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jaxb.adoc @@ -47,7 +47,7 @@ endif::[] [id="extensions-jaxb-usage"] == Usage -[id="extensions-usage-native-mode-objectfactory-instantiation-of-non-jaxb-annotated-classes"] +[id="extensions-jaxb-usage-native-mode-objectfactory-instantiation-of-non-jaxb-annotated-classes"] === Native mode `ObjectFactory` instantiation of non-JAXB annotated classes When performing JAXB marshal operations with a custom `ObjectFactory` to instantiate POJO classes that do not have JAXB annotations, diff --git a/docs/modules/ROOT/pages/reference/extensions/jdbc.adoc b/docs/modules/ROOT/pages/reference/extensions/jdbc.adoc index f7ce5acb30..cfe12c97b7 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jdbc.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jdbc.adoc @@ -48,7 +48,7 @@ endif::[] [id="extensions-jdbc-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-configuring-a-datasource"] +[id="extensions-jdbc-configuration-configuring-a-datasource"] === Configuring a DataSource This extension leverages https://quarkus.io/guides/datasource[Quarkus Agroal] for `DataSource` support. Setting up a `DataSource` can be achieved via configuration properties. @@ -65,6 +65,7 @@ quarkus.datasource.camel.jdbc.max-size=16 If you choose to not name the datasource, you can resolve the default `DataSource` by defining your endpoint like `to("jdbc:default")`. +[id="extensions-jdbc-configuration-zero-configuration-with-quarkus-dev-services"] ==== Zero configuration with Quarkus Dev Services In dev and test mode you can take advantage of https://quarkus.io/guides/datasource#dev-services-configuration-free-databases[Configuration Free Databases]. All you need to do is reference the default database in your routes. E.g `to("jdbc:default")`. diff --git a/docs/modules/ROOT/pages/reference/extensions/jms.adoc b/docs/modules/ROOT/pages/reference/extensions/jms.adoc index e2096b5563..1a9afef8c5 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jms.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jms.adoc @@ -47,12 +47,13 @@ endif::[] [id="extensions-jms-usage"] == Usage -[id="extensions-usage-message-mapping-with-org-w3c-dom-node"] +[id="extensions-jms-usage-message-mapping-with-org-w3c-dom-node"] === Message mapping with `org.w3c.dom.Node` The Camel JMS component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, you must ensure that the `camel-quarkus-jaxp` extension is present on the classpath. +[id="extensions-jms-usage-native-mode-support-for-javax-jms-objectmessage"] === Native mode support for javax.jms.ObjectMessage When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. diff --git a/docs/modules/ROOT/pages/reference/extensions/jpa.adoc b/docs/modules/ROOT/pages/reference/extensions/jpa.adoc index 9102b0a80b..f5af553fd8 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jpa.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jpa.adoc @@ -57,6 +57,7 @@ Also, it leverages https://quarkus.io/guides/transaction#programmatic-approach[Q When a single persistence unit is used, the Camel Quarkus JPA extension will automatically configure the JPA component with a `EntityManagerFactory` and `TransactionStrategy`. +[id="extensions-jpa-configuration-configuring-jpamessageidrepository"] === Configuring JpaMessageIdRepository It needs to use `EntityManagerFactory` and `TransactionStrategy` from the CDI container to configure the `JpaMessageIdRepository`: [source, java] diff --git a/docs/modules/ROOT/pages/reference/extensions/jq.adoc b/docs/modules/ROOT/pages/reference/extensions/jq.adoc index 090c0373b1..183567db42 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jq.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jq.adoc @@ -46,7 +46,7 @@ endif::[] [id="extensions-jq-usage"] == Usage -[id="extensions-usage-jq-transformations-to-custom-result-types-in-native-mode"] +[id="extensions-jq-usage-jq-transformations-to-custom-result-types-in-native-mode"] === JQ transformations to custom result types in native mode If you choose to perform JQ transformations that specify the result class as some custom type in native mode, diff --git a/docs/modules/ROOT/pages/reference/extensions/jslt.adoc b/docs/modules/ROOT/pages/reference/extensions/jslt.adoc index 671333aa54..742aeb6ad2 100644 --- a/docs/modules/ROOT/pages/reference/extensions/jslt.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/jslt.adoc @@ -53,7 +53,7 @@ The `allowContextMapAll` option is not supported in native mode as it requires r [id="extensions-jslt-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-loading-jslt-templates-from-classpath-in-native-mode"] +[id="extensions-jslt-configuration-loading-jslt-templates-from-classpath-in-native-mode"] === Loading JSLT templates from classpath in native mode This component typically loads the templates from classpath. @@ -76,6 +76,7 @@ quarkus.native.resources.includes = *.json More information about selecting resources for inclusion in the native executable can be found at xref:user-guide/native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable]. +[id="extensions-jslt-configuration-using-jslt-functions-in-native-mode"] === Using JSLT functions in native mode When using JSLT functions from camel-quarkus in native mode, the classes hosting the functions would need to be link:https://quarkus.io/guides/writing-native-applications-tips#registering-for-reflection[registered for reflection]. When registering the target function is not possible, one may end up writing a stub as below. diff --git a/docs/modules/ROOT/pages/reference/extensions/kafka.adoc b/docs/modules/ROOT/pages/reference/extensions/kafka.adoc index ddc90bbc59..70f0031186 100644 --- a/docs/modules/ROOT/pages/reference/extensions/kafka.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/kafka.adoc @@ -47,7 +47,7 @@ endif::[] [id="extensions-kafka-usage"] == Usage -[id="extensions-usage-quarkus-kafka-dev-services"] +[id="extensions-kafka-usage-quarkus-kafka-dev-services"] === Quarkus Kafka Dev Services Camel Quarkus Kafka can take advantage of https://quarkus.io/guides/kafka-dev-services[Quarkus Kafka Dev services] to simplify development and testing with a local containerized Kafka broker. diff --git a/docs/modules/ROOT/pages/reference/extensions/kamelet.adoc b/docs/modules/ROOT/pages/reference/extensions/kamelet.adoc index 88e8152722..7d6719b550 100644 --- a/docs/modules/ROOT/pages/reference/extensions/kamelet.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/kamelet.adoc @@ -46,11 +46,12 @@ endif::[] [id="extensions-kamelet-usage"] == Usage -[id="extensions-usage-pre-load-kamelets-at-build-time"] +[id="extensions-kamelet-usage-pre-load-kamelets-at-build-time"] === Pre-load Kamelets at build-time This extension allows to pre-load a set of Kamelets at build time using the `quarkus.camel.kamelet.identifiers` property. +[id="extensions-kamelet-usage-using-the-kamelet-catalog"] === Using the Kamelet Catalog A set of pre-made Kamelets can be found on the /camel-kamelets/latest[Kamelet Catalog]. diff --git a/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc b/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc index a065b62b38..87d1303777 100644 --- a/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/microprofile-health.adoc @@ -58,14 +58,17 @@ You can also provide custom `HealthCheckRepository` implementations and these ar Refer to the https://quarkus.io/guides/health-guide[Quarkus health guide] for further information. +[id="extensions-microprofile-health-usage-provided-health-checks"] === Provided health checks Some checks are automatically registered for your application. +[id="extensions-microprofile-health-usage-camel-context-health"] ==== Camel Context Health Inspects the Camel Context status and causes the health check status to be `DOWN` if the status is anything other than 'Started'. +[id="extensions-microprofile-health-usage-camel-route-health"] ==== Camel Route Health Inspects the status of each route and causes the health check status to be `DOWN` if any route status is not 'Started'. diff --git a/docs/modules/ROOT/pages/reference/extensions/microprofile-metrics.adoc b/docs/modules/ROOT/pages/reference/extensions/microprofile-metrics.adoc index efcc20b1b7..09627edc19 100644 --- a/docs/modules/ROOT/pages/reference/extensions/microprofile-metrics.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/microprofile-metrics.adoc @@ -49,6 +49,7 @@ endif::[] == Usage The xref:{cq-camel-components}::microprofile-metrics-component.adoc[microprofile-metrics] component automatically exposes a set of Camel application metrics. Some of these include: +[id="extensions-microprofile-metrics-usage-camel-context-metrics"] === Camel Context metrics [cols="80,.^20] @@ -105,6 +106,7 @@ The total number of all failures handled |=== +[id="extensions-microprofile-metrics-usage-camel-route-metrics"] === Camel Route metrics [cols="80,.^20] diff --git a/docs/modules/ROOT/pages/reference/extensions/platform-http.adoc b/docs/modules/ROOT/pages/reference/extensions/platform-http.adoc index 2a01b517fb..af1c221437 100644 --- a/docs/modules/ROOT/pages/reference/extensions/platform-http.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/platform-http.adoc @@ -50,7 +50,7 @@ endif::[] [id="extensions-platform-http-usage"] == Usage -[id="extensions-usage-basic-usage"] +[id="extensions-platform-http-usage-basic-usage"] === Basic Usage Serve all HTTP methods on the `/hello` endpoint: @@ -67,6 +67,7 @@ Serve only GET requests on the `/hello` endpoint: from("platform-http:/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}")); ---- +[id="extensions-platform-http-usage-using-platform-http-via-camel-rest-dsl"] === Using `platform-http` via Camel REST DSL To be able to use Camel REST DSL with the `platform-http` component, add `camel-quarkus-rest` to your `pom.xml`: @@ -91,6 +92,7 @@ rest() .to("direct:handlePostRequest"); ---- +[id="extensions-platform-http-usage-handling-multipart-form-data-file-uploads"] === Handling `multipart/form-data` file uploads You can restrict the uploads to certain file extensions by white listing them: @@ -113,6 +115,7 @@ from("platform-http:/upload/multipart?fileNameExtWhitelist=adoc,txt&httpMethodRe }); ---- +[id="extensions-platform-http-usage-securing-platform-http-endpoints"] === Securing `platform-http` endpoints Quarkus provides a variety of security and authentication mechanisms which can be used to secure `platform-http` endpoints. Refer to the https://quarkus.io/guides/security[Quarkus Security documentation] for further details. @@ -137,7 +140,7 @@ https://quarkus.io/guides/all-config#quarkus-vertx-http_quarkus-vertx-http-eclip [id="extensions-platform-http-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-platform-http-server-configuration"] +[id="extensions-platform-http-configuration-platform-http-server-configuration"] === Platform HTTP server configuration Configuration of the platform HTTP server is managed by Quarkus. Refer to the https://quarkus.io/guides/all-config#quarkus-vertx-http_quarkus-vertx-http-eclipse-vert.x-http[Quarkus HTTP configuration guide] @@ -146,6 +149,7 @@ for the full list of configuration options. To configure SSL for the Platform HTTP server, follow the https://quarkus.io/guides/http-reference#ssl[secure connections with SSL guide]. Note that configuring the server for SSL with `SSLContextParameters` is not currently supported. +[id="extensions-platform-http-configuration-character-encodings"] === Character encodings Check the xref:user-guide/native-mode.adoc#charsets[Character encodings section] of the Native mode guide if you expect diff --git a/docs/modules/ROOT/pages/reference/extensions/protobuf.adoc b/docs/modules/ROOT/pages/reference/extensions/protobuf.adoc index f4fbe69229..f91a91fd6e 100644 --- a/docs/modules/ROOT/pages/reference/extensions/protobuf.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/protobuf.adoc @@ -48,7 +48,7 @@ endif::[] [id="extensions-protobuf-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-generate-classes-from-protobuf-proto-files"] +[id="extensions-protobuf-configuration-generate-classes-from-protobuf-proto-files"] === Generate classes from protobuf `.proto` files Use the `generate-code` goal of `quarkus-maven-plugin` to generate Java classes from your `*.proto` service and message definitions stored in the `src/main/proto` directory: @@ -75,6 +75,7 @@ service and message definitions stored in the `src/main/proto` directory: The https://github.com/apache/camel-quarkus/tree/main/integration-tests/protobuf[camel-quarkus-protobuf integration test] is a good way to learn more. +[id="extensions-protobuf-configuration-serialize-deserialize-java-beans-using-json-fields-representation"] === Serialize/Deserialize Java beans using JSON fields representation Please note that some additional configurations might be needed when using `contentTypeFormat=json`. Indeed, in such a case, the generated `Builder` class needs to be registered for reflection. diff --git a/docs/modules/ROOT/pages/reference/extensions/quartz.adoc b/docs/modules/ROOT/pages/reference/extensions/quartz.adoc index 1e42e21058..d7259ece36 100644 --- a/docs/modules/ROOT/pages/reference/extensions/quartz.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/quartz.adoc @@ -48,7 +48,7 @@ endif::[] [id="extensions-quartz-usage"] == Usage ifeval::[{doc-show-advanced-features} == true] -[id="extensions-usage-advanced-clustering"] +[id="extensions-quartz-usage-advanced-clustering"] === Clustering Support for Quartz clustering is provided by the Quarkus Quartz extension. The following steps outline how to configure Quarkus Quartz for use with Camel. diff --git a/docs/modules/ROOT/pages/reference/extensions/qute.adoc b/docs/modules/ROOT/pages/reference/extensions/qute.adoc index 7d17bfb1fd..524e05ef37 100644 --- a/docs/modules/ROOT/pages/reference/extensions/qute.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/qute.adoc @@ -46,7 +46,7 @@ Please refer to the https://quarkus.io/guides/qute[Quarkus Qute]. [id="extensions-qute-camel-quarkus-limitations"] == Camel Quarkus limitations -[id="extensions-limitations-allowcontextmapall-option-in-native-mode"] +[id="extensions-qute-limitations-allowcontextmapall-option-in-native-mode"] == allowContextMapAll option in native mode The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as diff --git a/docs/modules/ROOT/pages/reference/extensions/salesforce.adoc b/docs/modules/ROOT/pages/reference/extensions/salesforce.adoc index f5f7699d4d..22405df4af 100644 --- a/docs/modules/ROOT/pages/reference/extensions/salesforce.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/salesforce.adoc @@ -47,7 +47,7 @@ endif::[] [id="extensions-salesforce-usage"] == Usage -[id="extensions-usage-generating-salesforce-dtos-with-the-salesforce-maven-plugin"] +[id="extensions-salesforce-usage-generating-salesforce-dtos-with-the-salesforce-maven-plugin"] === Generating Salesforce DTOs with the `salesforce-maven-plugin` ifeval::[{doc-show-extra-content} == true] diff --git a/docs/modules/ROOT/pages/reference/extensions/sjms.adoc b/docs/modules/ROOT/pages/reference/extensions/sjms.adoc index 45ae765e55..70297c433e 100644 --- a/docs/modules/ROOT/pages/reference/extensions/sjms.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/sjms.adoc @@ -47,12 +47,13 @@ endif::[] [id="extensions-sjms-usage"] == Usage -[id="extensions-usage-message-mapping-with-org-w3c-dom-node"] +[id="extensions-sjms-usage-message-mapping-with-org-w3c-dom-node"] === Message mapping with `org.w3c.dom.Node` The Camel SJMS component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, you must ensure that the `camel-quarkus-jaxp` extension is present on the classpath. +[id="extensions-sjms-usage-native-mode-support-for-javax-jms-objectmessage"] === Native mode support for javax.jms.ObjectMessage When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. diff --git a/docs/modules/ROOT/pages/reference/extensions/sjms2.adoc b/docs/modules/ROOT/pages/reference/extensions/sjms2.adoc index 60ff400353..f0bbb72347 100644 --- a/docs/modules/ROOT/pages/reference/extensions/sjms2.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/sjms2.adoc @@ -47,12 +47,13 @@ endif::[] [id="extensions-sjms2-usage"] == Usage -[id="extensions-usage-message-mapping-with-org-w3c-dom-node"] +[id="extensions-sjms2-usage-message-mapping-with-org-w3c-dom-node"] === Message mapping with `org.w3c.dom.Node` The Camel SJMS2 component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, you must ensure that the `camel-quarkus-jaxp` extension is present on the classpath. +[id="extensions-sjms2-usage-native-mode-support-for-javax-jms-objectmessage"] === Native mode support for javax.jms.ObjectMessage When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. diff --git a/docs/modules/ROOT/pages/reference/extensions/sql.adoc b/docs/modules/ROOT/pages/reference/extensions/sql.adoc index 9419b4671a..a8f5cb2984 100644 --- a/docs/modules/ROOT/pages/reference/extensions/sql.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/sql.adoc @@ -58,7 +58,7 @@ xref:{cq-camel-components}::sql-component.adoc#_using_the_jdbc_based_aggregation [id="extensions-sql-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-configuring-a-datasource"] +[id="extensions-sql-configuration-configuring-a-datasource"] === Configuring a DataSource This extension leverages https://quarkus.io/guides/datasource[Quarkus Agroal] for `DataSource` support. Setting up a `DataSource` can be achieved via configuration properties. @@ -75,10 +75,12 @@ quarkus.datasource.jdbc.max-size=16 The Camel SQL component will automatically resolve the `DataSource` bean from the registry. When configuring multiple datasources, you can specify which one is to be used on an SQL endpoint via the URI options `datasource` or `dataSourceRef`. Refer to the SQL component documentation for more details. +[id="extensions-sql-configuration-zero-configuration-with-quarkus-dev-services"] ==== Zero configuration with Quarkus Dev Services In dev and test mode you can take advantage of https://quarkus.io/guides/datasource#dev-services-configuration-free-databases[Configuration Free Databases]. The Camel SQL component will be automatically configured to use a `DataSource` that points to a local containerized instance of the database matching the JDBC driver type that you have selected. +[id="extensions-sql-configuration-sql-scripts"] === SQL scripts When configuring `sql` or `sql-stored` endpoints to reference script files from the classpath, set the following configuration property to ensure that they are available in native mode. @@ -88,6 +90,7 @@ When configuring `sql` or `sql-stored` endpoints to reference script files from quarkus.native.resources.includes = queries.sql, sql/*.sql ---- +[id="extensions-sql-configuration-sql-aggregation-repository-in-native-mode"] === SQL aggregation repository in native mode In order to use SQL aggregation repositories like `JdbcAggregationRepository` in native mode, you must xref:extensions/core.adoc#quarkus.camel.native.reflection.serialization-enabled[enable native serialization support]. diff --git a/docs/modules/ROOT/pages/reference/extensions/velocity.adoc b/docs/modules/ROOT/pages/reference/extensions/velocity.adoc index 3e516cbdd4..ac87d97ef8 100644 --- a/docs/modules/ROOT/pages/reference/extensions/velocity.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/velocity.adoc @@ -46,7 +46,7 @@ endif::[] [id="extensions-velocity-usage"] == Usage -[id="extensions-usage-custom-body-as-domain-object-in-the-native-mode"] +[id="extensions-velocity-usage-custom-body-as-domain-object-in-the-native-mode"] === Custom body as domain object in the native mode When using a custom object as message body and referencing its properties in the template in the native mode, all the classes need to be registered for reflection (see the https://quarkus.io/guides/writing-native-applications-tips#register-reflection[documentation]). diff --git a/docs/modules/ROOT/pages/reference/extensions/vertx-websocket.adoc b/docs/modules/ROOT/pages/reference/extensions/vertx-websocket.adoc index 22214badb6..e3304b0be6 100644 --- a/docs/modules/ROOT/pages/reference/extensions/vertx-websocket.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/vertx-websocket.adoc @@ -49,7 +49,7 @@ endif::[] [id="extensions-vertx-websocket-usage"] == Usage -[id="extensions-usage-vert-x-websocket-consumers"] +[id="extensions-vertx-websocket-usage-vert-x-websocket-consumers"] === Vert.x WebSocket consumers When you create a Vert.x WebSocket consumer (E.g with `from("vertx-websocket")`), the host and port configuration in the URI are redundant since the WebSocket will always be hosted on @@ -68,7 +68,7 @@ from("vertx-websocket://my-websocket-path") [id="extensions-vertx-websocket-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration -[id="extensions-configuration-vert-x-websocket-server-configuration"] +[id="extensions-vertx-websocket-configuration-vert-x-websocket-server-configuration"] === Vert.x WebSocket server configuration Configuration of the Vert.x WebSocket server is managed by Quarkus. Refer to the https://quarkus.io/guides/all-config#quarkus-vertx-http_quarkus-vertx-http-eclipse-vert.x-http[Quarkus HTTP configuration guide] @@ -77,6 +77,7 @@ for the full list of configuration options. To configure SSL for the Vert.x WebSocket server, follow the https://quarkus.io/guides/http-reference#ssl[secure connections with SSL guide]. Note that configuring the server for SSL with `SSLContextParameters` is not currently supported. +[id="extensions-vertx-websocket-configuration-character-encodings"] === Character encodings Check the xref:user-guide/native-mode.adoc#charsets[Character encodings section] of the Native mode guide if you expect diff --git a/docs/modules/ROOT/pages/reference/extensions/xslt.adoc b/docs/modules/ROOT/pages/reference/extensions/xslt.adoc index 87cfb31990..458f0def29 100644 --- a/docs/modules/ROOT/pages/reference/extensions/xslt.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/xslt.adoc @@ -61,12 +61,14 @@ Scheme-less URIs are interpreted as `classpath:` URIs. Only `classpath:` URIs are supported on Quarkus. `file:`, `http:` and other kinds of URIs do not work by design. +[id="extensions-xslt-configuration-configuration"] === Configuration TransformerFactory features can be configured using following property: [source,properties] ---- quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing"=false ---- +[id="extensions-xslt-configuration-extension-functions-support"] === Extension functions support https://xml.apache.org/xalan-j/extensions.html[Xalan's extension functions] do work properly only when: diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java index dca5e4c1c5..e2effb49ad 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java @@ -134,12 +134,12 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { if (lowerEqual_1_0_0(jvmSince)) { model.put("pageAliases", "extensions/" + ext.getRuntimeArtifactIdBase() + ".adoc"); } - model.put("intro", loadSection(basePath, "intro.adoc", charset, description)); + model.put("intro", loadSection(basePath, "intro.adoc", charset, description, ext)); model.put("models", models); - model.put("usage", loadSection(basePath, "usage.adoc", charset, null)); - model.put("usageAdvanced", loadSection(basePath, "usage-advanced.adoc", charset, null)); - model.put("configuration", loadSection(basePath, "configuration.adoc", charset, null)); - model.put("limitations", loadSection(basePath, "limitations.adoc", charset, null)); + model.put("usage", loadSection(basePath, "usage.adoc", charset, null, ext)); + model.put("usageAdvanced", loadSection(basePath, "usage-advanced.adoc", charset, null, ext)); + model.put("configuration", loadSection(basePath, "configuration.adoc", charset, null, ext)); + model.put("limitations", loadSection(basePath, "limitations.adoc", charset, null, ext)); model.put("activatesNativeSsl", ext.isNativeSupported() && detectNativeSsl(multiModuleProjectDirectory.toPath(), basePath, ext.getRuntimeArtifactId(), ext.getDependencies(), nativeSslActivators)); model.put("activatesContextMapAll", @@ -398,10 +398,15 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { }); } - private static String loadSection(Path basePath, String fileName, Charset charset, String default_) { + private static String loadSection( + Path basePath, + String fileName, + Charset charset, + String default_, + CamelQuarkusExtension extension) { Path p = basePath.resolve("src/main/doc/" + fileName); if (Files.exists(p)) { - AsciiDocFile file = new AsciiDocFile(p, charset); + AsciiDocFile file = new AsciiDocFile(p, extension.getRuntimeArtifactIdBase(), charset); for (DocumentationPostProcessor processor : documentationPostProcessors) { processor.process(file); } diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/AsciiDocFile.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/AsciiDocFile.java index fef6e9e377..1dfe9d03af 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/AsciiDocFile.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/AsciiDocFile.java @@ -27,11 +27,13 @@ import java.nio.file.Path; public class AsciiDocFile { private final Path path; + private final String cqExtension; private final Charset charset; private String content; - public AsciiDocFile(Path path, Charset charset) { + public AsciiDocFile(Path path, String cqExtension, Charset charset) { this.path = path; + this.cqExtension = cqExtension; this.charset = charset; this.content = load(); } @@ -44,6 +46,10 @@ public class AsciiDocFile { return path; } + public String getCqExtension() { + return cqExtension; + } + public void append(String contentToAppend) { content += contentToAppend; } diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/SectionIdPostProcessor.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/SectionIdPostProcessor.java index afcb380c6a..a570dbb478 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/SectionIdPostProcessor.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/processor/SectionIdPostProcessor.java @@ -16,7 +16,6 @@ */ package org.apache.camel.quarkus.maven.processor; -import java.nio.file.Path; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -24,30 +23,29 @@ import java.util.regex.Pattern; * {@link DocumentationPostProcessor} transform AsciiDoc headings to add ID blocks. */ public class SectionIdPostProcessor implements DocumentationPostProcessor { - private static final Pattern PATTERN_ASCIIDOC_HEADING = Pattern.compile("^=+\\s(.*)"); + private static final Pattern PATTERN_ASCIIDOC_HEADING = Pattern.compile("^=+ (.*)", Pattern.MULTILINE); private static final Pattern PATTERN_NON_ALPHA_NUMERIC = Pattern.compile("[^A-Za-z\\d-]"); private static final Pattern PATTERN_MULTIPLE_HYPHEN = Pattern.compile("-+"); - private static final Pattern PATTERN_END_OF_LINE_HYPHEN = Pattern.compile("-$"); + private static final Pattern PATTERN_TRIM_HYPHEN = Pattern.compile("^-|-$"); @Override public void process(AsciiDocFile file) { - Path path = file.getPath(); - String fileName = path.getFileName().toString(); - String cqExtension = fileName.substring(0, fileName.lastIndexOf('.')); - Matcher matcher = PATTERN_ASCIIDOC_HEADING.matcher(file.getContent()); while (matcher.find()) { String headingMarkup = matcher.group(0); String heading = matcher.group(1); - String id = generateAsciiDocIdentifier(cqExtension, heading.toLowerCase().trim()); + String fileName = file.getPath().getFileName().toString(); + String docType = fileName.substring(0, fileName.lastIndexOf('.')); + String id = generateAsciiDocIdentifier(file.getCqExtension(), docType, heading.toLowerCase().trim()); file.replace(headingMarkup, id + headingMarkup); } } - private String generateAsciiDocIdentifier(String extension, String heading) { - String sanitizedHeading = PATTERN_NON_ALPHA_NUMERIC.matcher(heading).replaceAll("-"); + private String generateAsciiDocIdentifier(String extension, String docType, String heading) { + String sanitizedHeading = String.format("extensions-%s-%s-%s", extension, docType, heading); + sanitizedHeading = PATTERN_NON_ALPHA_NUMERIC.matcher(sanitizedHeading).replaceAll("-"); sanitizedHeading = PATTERN_MULTIPLE_HYPHEN.matcher(sanitizedHeading).replaceAll("-"); - sanitizedHeading = PATTERN_END_OF_LINE_HYPHEN.matcher(sanitizedHeading).replaceAll(""); - return String.format("[id=\"extensions-%s-%s\"]\n", extension, sanitizedHeading); + sanitizedHeading = PATTERN_TRIM_HYPHEN.matcher(sanitizedHeading).replaceAll(""); + return String.format("[id=\"%s\"]\n", sanitizedHeading).toLowerCase(); } }