This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9197c3a8482147fe8a161f8fe68a6b196f6ddb28
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Wed Feb 21 11:15:33 2024 +0100

    CAMEL-20410: documentation fixes for camel-joor
    
    - Fixed samples
    - Fixed grammar and typos
    - Fixed punctuation
    - Added and/or fixed links
    - Converted to use tabs
---
 .../camel-joor/src/main/docs/java-language.adoc    | 45 +++++++-------
 .../camel-joor/src/main/docs/joor-language.adoc    | 70 +++++++++++++---------
 2 files changed, 66 insertions(+), 49 deletions(-)

diff --git a/components/camel-joor/src/main/docs/java-language.adoc 
b/components/camel-joor/src/main/docs/java-language.adoc
index 1dfedd2593d..14afca9f172 100644
--- a/components/camel-joor/src/main/docs/java-language.adoc
+++ b/components/camel-joor/src/main/docs/java-language.adoc
@@ -47,13 +47,13 @@ The Java language allows the following functions to be used 
in the script:
 | bodyAs(type) | To convert the body to the given type.
 | headerAs(name, type) | To convert the header with the name to the given type.
 | headerAs(name, defaultValue, type) | To convert the header with the name to 
the given type.
-If no header exists then use the given default value.
+If no header exists, then use the given default value.
 | exchangePropertyAs(name, type) | To convert the exchange property with the 
name to the given type.
 | exchangePropertyAs(name, defaultValue, type) | To convert the exchange 
property with the name to the given type.
-If no exchange property exists then use the given default value.
-| optionalBodyAs(type) | To convert the body to the given type returned 
wrapped in `java.util.Optional`.
-| optionalHeaderAs(name, type) | To convert the header with the name to the 
given type returned wrapped in `java.util.Optional`.
-| optionalExchangePropertyAs(name, type) | To convert the exchange property 
with the name to the given type returned wrapped in `java.util.Optional`.
+If no exchange property exists, then use the given default value.
+| optionalBodyAs(type) | To convert the body to the given type, returned 
wrapped in `java.util.Optional`.
+| optionalHeaderAs(name, type) | To convert the header with the name to the 
given type, returned wrapped in `java.util.Optional`.
+| optionalExchangePropertyAs(name, type) | To convert the exchange property 
with the name to the given type, returned wrapped in `java.util.Optional`.
 |===
 
 These functions are convenient for getting the message body, header or 
exchange properties as a specific Java type.
@@ -90,12 +90,12 @@ var user = bodyAs(MyUser);
 == Dependency Injection
 
 The Camel Java language allows dependency injection by referring to beans by 
their id from the Camel registry.
-For optimization purposes then the beans are injected once in the constructor 
and the scopes are _singleton_.
+For optimization purposes, then the beans are injected once in the constructor 
and the scopes are _singleton_.
 This requires the injected beans to be _thread safe_ as they will be reused 
for all processing.
 
 In the Java code you declare the injected beans using the syntax 
`#bean:beanId`.
 
-For example suppose we have the following bean
+For example, suppose we have the following bean
 
 [source,java]
 ----
@@ -122,9 +122,9 @@ from("direct:start")
     .to("mock:result");
 ----
 
-Now this code may seem a bit magically, but what happens is that the `myEcho` 
bean is injected via a constructor, and then called directly in the script, so 
it is as fast as possible.
+Now this code may seem a bit magic, but what happens is that the `myEcho` bean 
is injected via a constructor, and then called directly in the script, so it is 
as fast as possible.
 
-Under the hood, Camel Java generates the following source code that is 
compiled once:
+Under the hood, Camel Java generates the following source code compiled once:
 
 [source,java]
 ----
@@ -153,7 +153,8 @@ from("direct:start")
 ----
 
 Notice how we declare the bean as if it is a local variable via `var bean = 
#bean:myEcho`.
-When doing this we must use a different name as `myEcho` is the variable used 
by the dependency injection and therefore we use _bean_ as name in the script.
+When doing this we must use a different name as `myEcho` is the variable used 
by the dependency injection.
+Therefore, we use _bean_ as name in the script.
 
 == Auto imports
 
@@ -182,14 +183,14 @@ import com.bar.*;
 import static com.foo.MyHelper.*;
 ----
 
-You can also add aliases (key=value) where an alias will be used as a 
shorthand replacement in the code.
+You can also add aliases (`key=value`) where an alias will be used as a 
shorthand replacement in the code.
 
 [source,properties]
 ----
 echo()=bodyAs(String) + bodyAs(String)
 ----
 
-Which allows using _echo()_ in the jOOR language script such as:
+Which allows using `echo()` in the jOOR language script such as:
 
 [source,java]
 ----
@@ -198,7 +199,7 @@ from("direct:hello")
     .log("You said ${body}");
 ----
 
-The _echo()_ alias will be replaced with its value resulting in a script as:
+The `echo()` alias will be replaced with its value resulting in a script as:
 
 [source,java]
 ----
@@ -223,7 +224,7 @@ camelContext.getRegistry().put("MyJoorConfig", config);
 
 == Example
 
-For example to transform the message using jOOR language to upper case
+For example, to transform the message using jOOR language to the upper case
 
 [source,java]
 ----
@@ -269,7 +270,7 @@ from("seda:orders")
 
 == Hot re-load
 
-You can turn off pre compilation for the Java language and then Camel will 
recompile the script for each message.
+You can turn off pre-compilation for the Java language and then Camel will 
recompile the script for each message.
 You can externalize the code into a resource file, which will be reloaded on 
each message as shown:
 
 [source,java]
@@ -297,12 +298,12 @@ In XML DSL it's easier because you can turn off 
pre-compilation in the `<java>`
 </route>
 ----
 
-== Lambda based AggregationStrategy
+== Lambda-based AggregationStrategy
 
-The Java language have special support for defining an 
`org.apache.camel.AggregationStrategy` as a lambda expression.
-This is useful when using EIP patterns that uses aggregation such as the 
Aggregator, Splitter, Recipient List, Enrich, and others.
+The Java language has special support for defining an 
`org.apache.camel.AggregationStrategy` as a lambda expression.
+This is useful when using EIP patterns that use aggregation such as the 
Aggregator, Splitter, Recipient List, Enrich, and others.
 
-To use this then the Java language script must be in the following syntax:
+To use this, then the Java language script must be in the following syntax:
 
 ----
 (e1, e2) -> { }
@@ -313,7 +314,7 @@ The returned value is used as the aggregated message body, 
or use `null` to skip
 
 The lambda syntax is representing a Java util `BiFunction<Exchange, Exchange, 
Object>` type.
 
-For example to aggregate message bodies together we can do this as shown:
+For example, to aggregate message bodies together, we can do this as shown:
 
 [source,java]
 ----
@@ -336,9 +337,9 @@ Java does not support runtime compilation with Spring Boot 
using _fat jar_ packa
 
 == Dependencies
 
-To use scripting languages in your camel routes you need to add a dependency 
on *camel-joor*.
+To use scripting languages in your camel routes, you need to add a dependency 
on *camel-joor*.
 
-If you use Maven you could just add the following to your `pom.xml`, 
substituting the version number for the latest and greatest release (see the 
download page for the latest versions).
+If you use Maven you could add the following to your `pom.xml`, substituting 
the version number for the latest and greatest release.
 
 [source,xml]
 ---------------------------------------
diff --git a/components/camel-joor/src/main/docs/joor-language.adoc 
b/components/camel-joor/src/main/docs/joor-language.adoc
index 5ff6564fdb2..7d1bf19e659 100644
--- a/components/camel-joor/src/main/docs/joor-language.adoc
+++ b/components/camel-joor/src/main/docs/joor-language.adoc
@@ -52,13 +52,13 @@ The jOOR language allows the following functions to be used 
in the script:
 | bodyAs(type) | To convert the body to the given type.
 | headerAs(name, type) | To convert the header with the name to the given type.
 | headerAs(name, defaultValue, type) | To convert the header with the name to 
the given type.
-If no header exists then use the given default value.
+If no header exists, then use the given default value.
 | exchangePropertyAs(name, type) | To convert the exchange property with the 
name to the given type.
 | exchangePropertyAs(name, defaultValue, type) | To convert the exchange 
property with the name to the given type.
-If no exchange property exists then use the given default value.
-| optionalBodyAs(type) | To convert the body to the given type returned 
wrapped in `java.util.Optional`.
-| optionalHeaderAs(name, type) | To convert the header with the name to the 
given type returned wrapped in `java.util.Optional`.
-| optionalExchangePropertyAs(name, type) | To convert the exchange property 
with the name to the given type returned wrapped in `java.util.Optional`.
+If no exchange property exists, then use the given default value.
+| optionalBodyAs(type) | To convert the body to the given type, returned 
wrapped in `java.util.Optional`.
+| optionalHeaderAs(name, type) | To convert the header with the name to the 
given type, returned wrapped in `java.util.Optional`.
+| optionalExchangePropertyAs(name, type) | To convert the exchange property 
with the name to the given type, returned wrapped in `java.util.Optional`.
 |===
 
 These functions are convenient for getting the message body, header or 
exchange properties as a specific Java type.
@@ -95,12 +95,12 @@ var user = bodyAs(MyUser);
 == Dependency Injection
 
 The Camel jOOR language allows dependency injection by referring to beans by 
their id from the Camel registry.
-For optimization purposes then the beans are injected once in the constructor 
and the scopes are _singleton_.
+For optimization purposes, then the beans are injected once in the constructor 
and the scopes are _singleton_.
 This requires the injected beans to be _thread safe_ as they will be reused 
for all processing.
 
 In the jOOR script you declare the injected beans using the syntax 
`#bean:beanId`.
 
-For example suppose we have the following bean
+For example, suppose we have the following bean
 
 [source,java]
 ----
@@ -127,9 +127,9 @@ from("direct:start")
     .to("mock:result");
 ----
 
-Now this code may seem a bit magically, but what happens is that the `myEcho` 
bean is injected via a constructor, and then called directly in the script, so 
it is as fast as possible.
+Now this code may seem a bit magic, but what happens is that the `myEcho` bean 
is injected via a constructor, and then called directly in the script, so it is 
as fast as possible.
 
-Under the hood, Camel jOOR generates the following source code that is 
compiled once:
+Under the hood, Camel jOOR generates the following source code compiled once:
 
 [source,java]
 ----
@@ -158,11 +158,12 @@ from("direct:start")
 ----
 
 Notice how we declare the bean as if it is a local variable via `var bean = 
#bean:myEcho`.
-When doing this we must use a different name as `myEcho` is the variable used 
by the dependency injection and therefore we use _bean_ as name in the script.
+When doing this, we must use a different name as `myEcho` is the variable used 
by the dependency injection.
+Therefore, we use _bean_ as name in the script.
 
 == Auto imports
 
-The jOOR language will automatic import from:
+The jOOR language will automatically import from:
 
 [source,java]
 ----
@@ -178,7 +179,7 @@ import org.apache.camel.util.*;
 You can configure the jOOR language in the `camel-joor.properties` file which 
by default is loaded from the root classpath.
 You can specify a different location with the `configResource` option on the 
jOOR language.
 
-For example you can add additional imports in the `camel-joor.properties` file 
by adding:
+For example, you can add additional imports in the `camel-joor.properties` 
file by adding:
 
 [source,properties]
 ----
@@ -187,14 +188,14 @@ import com.bar.*;
 import static com.foo.MyHelper.*;
 ----
 
-You can also add aliases (key=value) where an alias will be used as a 
shorthand replacement in the code.
+You can also add aliases (`key=value`) where an alias will be used as a 
shorthand replacement in the code.
 
 [source,properties]
 ----
 echo()=bodyAs(String) + bodyAs(String)
 ----
 
-Which allows using _echo()_ in the jOOR language script such as:
+Which allows using `echo()` in the jOOR language script such as:
 
 [source,java]
 ----
@@ -203,7 +204,7 @@ from("direct:hello")
     .log("You said ${body}");
 ----
 
-The _echo()_ alias will be replaced with its value resulting in a script as:
+The `echo()` alias will be replaced with its value resulting in a script as:
 
 [source,java]
 ----
@@ -228,8 +229,12 @@ camelContext.getRegistry().put("MyJoorConfig", config);
 
 == Example
 
-For example to transform the message using jOOR language to upper case
+For example, to transform the message using jOOR language to the upper case
 
+[tabs]
+====
+Java::
++
 [source,java]
 ----
 from("seda:orders")
@@ -237,8 +242,8 @@ from("seda:orders")
   .to("seda:upper");
 ----
 
-And in XML DSL:
-
+XML DSL::
++
 [source,xml]
 ----
 <route>
@@ -250,6 +255,8 @@ And in XML DSL:
 </route>
 ----
 
+====
+
 == Multi statements
 
 It is possible to include multiple statements.
@@ -274,9 +281,14 @@ from("seda:orders")
 
 == Hot re-load
 
-You can turn off pre compilation for the jOOR language and then Camel will 
recompile the script for each message.
+You can turn off pre-compilation for the jOOR language and then Camel will 
recompile the script for each message.
 You can externalize the code into a resource file, which will be reloaded on 
each message as shown:
 
+[tabs]
+====
+Java::
++
+
 [source,java]
 ----
 JoorLanguage joor = (JoorLanguage) context.resolveLanguage("joor");
@@ -286,11 +298,13 @@ from("jms:incoming")
     .transform().joor("resource:file:src/main/resources/orders.joor")
     .to("jms:orders");
 ----
-
++
 Here the jOOR script is externalized into the file 
`src/main/resources/orders.joor` which allows you to edit this source file 
while running the Camel application and try the changes with hot-reloading.
 
+XML::
++
 In XML DSL it's easier because you can turn off pre-compilation in the 
`<joor>` XML element:
-
++
 [source,xml]
 ----
 <route>
@@ -302,10 +316,12 @@ In XML DSL it's easier because you can turn off 
pre-compilation in the `<joor>`
 </route>
 ----
 
-== Lambda based AggregationStrategy
+====
+
+== Lambda-based AggregationStrategy
 
-The jOOR language have special support for defining an 
`org.apache.camel.AggregationStrategy` as a lambda expression.
-This is useful when using EIP patterns that uses aggregation such as the 
Aggregator, Splitter, Recipient List, Enrich, and others.
+The jOOR language has special support for defining an 
`org.apache.camel.AggregationStrategy` as a lambda expression.
+This is useful when using EIP patterns that use aggregation such as the 
Aggregator, Splitter, Recipient List, Enrich, and others.
 
 To use this then the jOOR language script must be in the following syntax:
 
@@ -318,7 +334,7 @@ The returned value is used as the aggregated message body, 
or use `null` to skip
 
 The lambda syntax is representing a Java util `BiFunction<Exchange, Exchange, 
Object>` type.
 
-For example to aggregate message bodies together we can do this as shown:
+For example, to aggregate message bodies together, we can do this as shown:
 
 [source,java]
 ----
@@ -341,9 +357,9 @@ jOOR does not support runtime compilation with Spring Boot 
using _fat jar_ packa
 
 == Dependencies
 
-To use scripting languages in your camel routes you need to add a dependency 
on *camel-joor*.
+To use scripting languages in your camel routes, you need to add a dependency 
on *camel-joor*.
 
-If you use Maven you could just add the following to your `pom.xml`, 
substituting the version number for the latest and greatest release (see the 
download page for the latest versions).
+If you use Maven you could add the following to your `pom.xml`, substituting 
the version number for the latest and greatest release.
 
 [source,xml]
 ---------------------------------------

Reply via email to