You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/16 10:47:13 UTC
camel git commit: CAMEL-9541: Generate readme for language also.
Repository: camel
Updated Branches:
refs/heads/master 96f3710b7 -> 536ec533a
CAMEL-9541: Generate readme for language also.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/536ec533
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/536ec533
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/536ec533
Branch: refs/heads/master
Commit: 536ec533a16c5ee6de2c4b62aadbadec049c22ea
Parents: 96f3710
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Aug 16 12:47:01 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Aug 16 12:47:01 2016 +0200
----------------------------------------------------------------------
camel-core/src/main/docs/constant-language.adoc | 61 +++++
camel-core/src/main/docs/constant.adoc | 41 ----
.../src/main/docs/groovy-language.adoc | 216 +++++++++++++++++
.../camel-groovy/src/main/docs/groovy.adoc | 204 ----------------
.../src/main/docs/jsonpath-language.adoc | 238 +++++++++++++++++++
.../camel-jsonpath/src/main/docs/jsonpath.adoc | 214 -----------------
.../src/main/docs/jxpath-language.adoc | 172 ++++++++++++++
.../camel-jxpath/src/main/docs/jxpath.adoc | 150 ------------
.../camel-ognl/src/main/docs/ognl-language.adoc | 138 +++++++++++
components/camel-ognl/src/main/docs/ognl.adoc | 117 ---------
.../maven/packaging/ReadmeComponentMojo.java | 165 +++++++++++++
.../src/main/resources/dataformat-header.mvel | 15 --
.../src/main/resources/language-options.mvel | 15 ++
13 files changed, 1005 insertions(+), 741 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/camel-core/src/main/docs/constant-language.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/constant-language.adoc b/camel-core/src/main/docs/constant-language.adoc
new file mode 100644
index 0000000..68264b3
--- /dev/null
+++ b/camel-core/src/main/docs/constant-language.adoc
@@ -0,0 +1,61 @@
+[[Constant-ConstantExpressionLanguage]]
+Constant Expression Language
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The Constant Expression Language is really just a way to specify
+constant strings as a type of expression.
+
+[[Constant-Options]]
+Constant Options
+^^^^^^^^^^^^^^
+
+
+// language options: START
+The Constant language supports 1 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|=======================================================================
+{% endraw %}
+// language options: END
+
+
+[[Constant-Exampleusage]]
+Example usage
+^^^^^^^^^^^^^
+
+The setHeader element of the Spring DSL can utilize a constant
+expression like:
+
+[source,xml]
+------------------------------------------
+<route>
+ <from uri="seda:a"/>
+ <setHeader headerName="theHeader">
+ <constant>the value</constant>
+ </setHeader>
+ <to uri="mock:b"/>
+</route>
+------------------------------------------
+
+in this case, the link:message.html[Message] coming from the seda:a
+link:endpoint.html[Endpoint] will have 'theHeader' header set to the
+constant value 'the value'.
+
+And the same example using Java DSL:
+
+[source,java]
+--------------------------------------------------------------------------
+from("seda:a").setHeader("theHeader", constant("the value")).to("mock:b");
+--------------------------------------------------------------------------
+
+[[Constant-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+The Constant language is part of *camel-core*.
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/camel-core/src/main/docs/constant.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/constant.adoc b/camel-core/src/main/docs/constant.adoc
deleted file mode 100644
index b54df7d..0000000
--- a/camel-core/src/main/docs/constant.adoc
+++ /dev/null
@@ -1,41 +0,0 @@
-[[Constant-ConstantExpressionLanguage]]
-Constant Expression Language
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The Constant Expression Language is really just a way to specify
-constant strings as a type of expression.
-
-[[Constant-Exampleusage]]
-Example usage
-^^^^^^^^^^^^^
-
-The setHeader element of the Spring DSL can utilize a constant
-expression like:
-
-[source,xml]
-------------------------------------------
-<route>
- <from uri="seda:a"/>
- <setHeader headerName="theHeader">
- <constant>the value</constant>
- </setHeader>
- <to uri="mock:b"/>
-</route>
-------------------------------------------
-
-in this case, the link:message.html[Message] coming from the seda:a
-link:endpoint.html[Endpoint] will have 'theHeader' header set to the
-constant value 'the value'.
-
-And the same example using Java DSL:
-
-[source,java]
---------------------------------------------------------------------------
-from("seda:a").setHeader("theHeader", constant("the value")).to("mock:b");
---------------------------------------------------------------------------
-
-[[Constant-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-The Constant language is part of *camel-core*.
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-groovy/src/main/docs/groovy-language.adoc
----------------------------------------------------------------------
diff --git a/components/camel-groovy/src/main/docs/groovy-language.adoc b/components/camel-groovy/src/main/docs/groovy-language.adoc
new file mode 100644
index 0000000..0a1075e
--- /dev/null
+++ b/components/camel-groovy/src/main/docs/groovy-language.adoc
@@ -0,0 +1,216 @@
+[[Groovy-Groovy]]
+Groovy
+~~~~~~
+
+Camel supports http://groovy.codehaus.org/[Groovy] among other
+link:scripting-languages.html[Scripting Languages] to allow an
+link:expression.html[Expression] or link:predicate.html[Predicate] to be
+used in the link:dsl.html[DSL] or link:xml-configuration.html[Xml
+Configuration].
+
+To use a Groovy expression use the following Java code
+
+[source,java]
+---------------------------------------
+... groovy("someGroovyExpression") ...
+---------------------------------------
+
+For example you could use the *groovy* function to create an
+link:predicate.html[Predicate] in a link:message-filter.html[Message
+Filter] or as an link:expression.html[Expression] for a
+link:recipient-list.html[Recipient List]
+
+[[Groovy-Options]]
+Groovy Options
+^^^^^^^^^^^^^^
+
+
+
+// language options: START
+The Groovy language supports 1 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|=======================================================================
+{% endraw %}
+// language options: END
+
+
+
+[[Groovy-CustomizingGroovyShell]]
+Customizing Groovy Shell
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Sometimes you may need to use custom `GroovyShell` instance in your
+Groovy expressions. To provide custom `GroovyShell`, add implementation
+of the�`org.apache.camel.language.groovy.GroovyShellFactory` SPI
+interface to your Camel registry. For example after adding the following
+bean to your Spring context...
+
+[source,java]
+----------------------------------------------------------------------
+public class CustomGroovyShellFactory implements GroovyShellFactory {
+�
+ public GroovyShell createGroovyShell(Exchange exchange) {
+ ImportCustomizer importCustomizer = new ImportCustomizer();
+ importCustomizer.addStaticStars("com.example.Utils");
+ CompilerConfiguration configuration = new CompilerConfiguration();
+ configuration.addCompilationCustomizers(importCustomizer);
+ return new GroovyShell(configuration);
+ }
+
+}
+----------------------------------------------------------------------
+
+...Camel will use your custom GroovyShell instance (containing your
+custom static imports), instead of the default one.
+
+[[Groovy-Example]]
+Example
+^^^^^^^
+
+[source,java]
+------------------------------------------------------------------------------------------------
+// lets route if a line item is over $100
+from("queue:foo").filter(groovy("request.lineItems.any { i -> i.value > 100 }")).to("queue:bar")
+------------------------------------------------------------------------------------------------
+
+And the Spring DSL:
+
+[source,xml]
+-----------------------------------------------------------------------------
+ <route>
+ <from uri="queue:foo"/>
+ <filter>
+ <groovy>request.lineItems.any { i -> i.value > 100 }</groovy>
+ <to uri="queue:bar"/>
+ </filter>
+ </route>
+-----------------------------------------------------------------------------
+
+[[Groovy-ScriptContext]]
+ScriptContext
+^^^^^^^^^^^^^
+
+The JSR-223 scripting languages ScriptContext is pre configured with the
+following attributes all set at `ENGINE_SCOPE`:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Attribute |Type |Value
+
+|context |`org.apache.camel.CamelContext` |The Camel Context ( It cannot be used in groovy)
+
+|camelContext |`org.apache.camel.CamelContext` |The Camel Context
+
+|exchange |`org.apache.camel.Exchange` |The current Exchange
+
+|request |`org.apache.camel.Message` |The message (IN message)
+
+|response |`org.apache.camel.Message` |*Deprecated*: The OUT message. The OUT message if null by default. Use
+IN message instead.
+
+|properties |`org.apache.camel.builder.script.PropertiesFunction` |*Camel 2.9:* Function with a `resolve` method to make it easier to use
+Camels link:properties.html[Properties] component from scripts. See
+further below for example.
+|=======================================================================
+
+See link:scripting-languages.html[Scripting Languages] for the list of
+languages with explicit DSL support.
+
+[[Groovy-AdditionalargumentstoScriptingEngine]]
+Additional arguments to ScriptingEngine
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.8*
+
+You can provide additional arguments to the `ScriptingEngine` using a
+header on the Camel message with the key `CamelScriptArguments`. +
+ See this example:
+
+[[Groovy-Usingpropertiesfunction]]
+Using properties function
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.9*
+
+If you need to use the link:properties.html[Properties] component from a
+script to lookup property placeholders, then its a bit cumbersome to do
+so.
+For example to set a header name myHeader with a value from a property
+placeholder, which key is provided in a header named "foo".
+
+[source,java]
+------------------------------------------------------------------------------------------------------------------------------
+.setHeader("myHeader").groovy(""context.resolvePropertyPlaceholders( + '{{' + request.headers.get('foo') + '}}' + ")")
+------------------------------------------------------------------------------------------------------------------------------
+
+From Camel 2.9 onwards you can now use the properties function and the
+same example is simpler:
+
+[source,java]
+---------------------------------------------------------------------------------------
+.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+---------------------------------------------------------------------------------------
+
+[[Groovy-Loadingscriptfromexternalresource]]
+Loading script from external resource
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.11*
+
+You can externalize the script and have Camel load it from a resource
+such as `"classpath:"`, `"file:"`, or `"http:"`. +
+ This is done using the following syntax: `"resource:scheme:location"`,
+eg to refer to a file on the classpath you can do:
+
+[source,java]
+-------------------------------------------------------------------
+.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
+-------------------------------------------------------------------
+
+[[Groovy-Howtogettheresultfrommultiplestatementsscript]]
+How to get the result from multiple statements script
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.14*
+
+As the scripteengine evale method just return a Null if it runs a
+multiple statments script. Camel now look up the value of script result
+by using the key of "result" from the value set. If you have multiple
+statements script, you need to make sure you set the value of result
+variable as the script return value.
+
+[source,text]
+-------------------------------------------------------------
+bar = "baz";
+# some other statements ...
+# camel take the result value as the script evaluation result
+result = body * 2 + 1
+-------------------------------------------------------------
+
+[[Groovy-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use scripting languages in your camel routes you need to add the a
+dependency on *camel-script* which integrates the JSR-223 scripting
+engine.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,xml]
+---------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-script</artifactId>
+ <version>x.x.x</version>
+</dependency>
+---------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-groovy/src/main/docs/groovy.adoc
----------------------------------------------------------------------
diff --git a/components/camel-groovy/src/main/docs/groovy.adoc b/components/camel-groovy/src/main/docs/groovy.adoc
deleted file mode 100644
index 87014fa..0000000
--- a/components/camel-groovy/src/main/docs/groovy.adoc
+++ /dev/null
@@ -1,204 +0,0 @@
-[[Groovy-Groovy]]
-Groovy
-~~~~~~
-
-Camel supports http://groovy.codehaus.org/[Groovy] among other
-link:scripting-languages.html[Scripting Languages] to allow an
-link:expression.html[Expression] or link:predicate.html[Predicate] to be
-used in the link:dsl.html[DSL] or link:xml-configuration.html[Xml
-Configuration].
-
-To use a Groovy expression use the following Java code
-
-[source,java]
----------------------------------------
-... groovy("someGroovyExpression") ...
----------------------------------------
-
-For example you could use the *groovy* function to create an
-link:predicate.html[Predicate] in a link:message-filter.html[Message
-Filter] or as an link:expression.html[Expression] for a
-link:recipient-list.html[Recipient List]
-
-[[Groovy-Options]]
-Groovy Options
-^^^^^^^^^^^^^^
-
-// component options: START
-// component options: END
-
-// endpoint options: START
-// endpoint options: END
-
-[[Groovy-CustomizingGroovyShell]]
-Customizing Groovy Shell
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Sometimes you may need to use custom `GroovyShell` instance in your
-Groovy expressions. To provide custom `GroovyShell`, add implementation
-of the�`org.apache.camel.language.groovy.GroovyShellFactory` SPI
-interface to your Camel registry. For example after adding the following
-bean to your Spring context...
-
-[source,java]
-----------------------------------------------------------------------
-public class CustomGroovyShellFactory implements GroovyShellFactory {
-�
- public GroovyShell createGroovyShell(Exchange exchange) {
- ImportCustomizer importCustomizer = new ImportCustomizer();
- importCustomizer.addStaticStars("com.example.Utils");
- CompilerConfiguration configuration = new CompilerConfiguration();
- configuration.addCompilationCustomizers(importCustomizer);
- return new GroovyShell(configuration);
- }
-
-}
-----------------------------------------------------------------------
-
-...Camel will use your custom GroovyShell instance (containing your
-custom static imports), instead of the default one.
-
-[[Groovy-Example]]
-Example
-^^^^^^^
-
-[source,java]
-------------------------------------------------------------------------------------------------
-// lets route if a line item is over $100
-from("queue:foo").filter(groovy("request.lineItems.any { i -> i.value > 100 }")).to("queue:bar")
-------------------------------------------------------------------------------------------------
-
-And the Spring DSL:
-
-[source,xml]
------------------------------------------------------------------------------
- <route>
- <from uri="queue:foo"/>
- <filter>
- <groovy>request.lineItems.any { i -> i.value > 100 }</groovy>
- <to uri="queue:bar"/>
- </filter>
- </route>
------------------------------------------------------------------------------
-
-[[Groovy-ScriptContext]]
-ScriptContext
-^^^^^^^^^^^^^
-
-The JSR-223 scripting languages ScriptContext is pre configured with the
-following attributes all set at `ENGINE_SCOPE`:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Attribute |Type |Value
-
-|context |`org.apache.camel.CamelContext` |The Camel Context ( It cannot be used in groovy)
-
-|camelContext |`org.apache.camel.CamelContext` |The Camel Context
-
-|exchange |`org.apache.camel.Exchange` |The current Exchange
-
-|request |`org.apache.camel.Message` |The message (IN message)
-
-|response |`org.apache.camel.Message` |*Deprecated*: The OUT message. The OUT message if null by default. Use
-IN message instead.
-
-|properties |`org.apache.camel.builder.script.PropertiesFunction` |*Camel 2.9:* Function with a `resolve` method to make it easier to use
-Camels link:properties.html[Properties] component from scripts. See
-further below for example.
-|=======================================================================
-
-See link:scripting-languages.html[Scripting Languages] for the list of
-languages with explicit DSL support.
-
-[[Groovy-AdditionalargumentstoScriptingEngine]]
-Additional arguments to ScriptingEngine
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.8*
-
-You can provide additional arguments to the `ScriptingEngine` using a
-header on the Camel message with the key `CamelScriptArguments`. +
- See this example:
-
-[[Groovy-Usingpropertiesfunction]]
-Using properties function
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.9*
-
-If you need to use the link:properties.html[Properties] component from a
-script to lookup property placeholders, then its a bit cumbersome to do
-so.
-For example to set a header name myHeader with a value from a property
-placeholder, which key is provided in a header named "foo".
-
-[source,java]
-------------------------------------------------------------------------------------------------------------------------------
-.setHeader("myHeader").groovy(""context.resolvePropertyPlaceholders( + '{{' + request.headers.get('foo') + '}}' + ")")
-------------------------------------------------------------------------------------------------------------------------------
-
-From Camel 2.9 onwards you can now use the properties function and the
-same example is simpler:
-
-[source,java]
----------------------------------------------------------------------------------------
-.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
----------------------------------------------------------------------------------------
-
-[[Groovy-Loadingscriptfromexternalresource]]
-Loading script from external resource
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.11*
-
-You can externalize the script and have Camel load it from a resource
-such as `"classpath:"`, `"file:"`, or `"http:"`. +
- This is done using the following syntax: `"resource:scheme:location"`,
-eg to refer to a file on the classpath you can do:
-
-[source,java]
--------------------------------------------------------------------
-.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
--------------------------------------------------------------------
-
-[[Groovy-Howtogettheresultfrommultiplestatementsscript]]
-How to get the result from multiple statements script
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.14*
-
-As the scripteengine evale method just return a Null if it runs a
-multiple statments script. Camel now look up the value of script result
-by using the key of "result" from the value set. If you have multiple
-statements script, you need to make sure you set the value of result
-variable as the script return value.
-
-[source,text]
--------------------------------------------------------------
-bar = "baz";
-# some other statements ...
-# camel take the result value as the script evaluation result
-result = body * 2 + 1
--------------------------------------------------------------
-
-[[Groovy-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use scripting languages in your camel routes you need to add the a
-dependency on *camel-script* which integrates the JSR-223 scripting
-engine.
-
-If you use maven you could just add the following to your pom.xml,
-substituting the version number for the latest & greatest release (see
-link:download.html[the download page for the latest versions]).
-
-[source,xml]
----------------------------------------
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-script</artifactId>
- <version>x.x.x</version>
-</dependency>
----------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc b/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
new file mode 100644
index 0000000..9b0b758
--- /dev/null
+++ b/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
@@ -0,0 +1,238 @@
+[[JSonPath-JSonPath]]
+JSonPath
+~~~~~~~~
+
+*Available as of Camel 2.13*
+
+Camel supports https://code.google.com/p/json-path/[JSonPath] to allow
+using link:expression.html[Expression] or link:predicate.html[Predicate]
+on json messages.
+
+[source,java]
+-----------------------------------------------------
+from("queue:books.new")
+ .choice()
+ .when().jsonpath("$.store.book[?(@.price < 10)]")
+ .to("jms:queue:book.cheap")
+ .when().jsonpath("$.store.book[?(@.price < 30)]")
+ .to("jms:queue:book.average")
+ .otherwise()
+ .to("jms:queue:book.expensive")
+-----------------------------------------------------
+
+[[JSonPath-Options]]
+JSonPath Options
+^^^^^^^^^^^^^^^^
+
+
+// language options: START
+The JSonPath language supports 4 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| resultType | | String | Sets the class name of the result type (type from output)
+| suppressExceptions | false | Boolean | Whether to suppress exceptions such as PathNotFoundException.
+| allowSimple | true | Boolean | Whether to allow in inlined simple exceptions in the json path expression
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|=======================================================================
+{% endraw %}
+// language options: END
+
+
+
+[[JSonPath-UsingXMLconfiguration]]
+Using XML configuration
+^^^^^^^^^^^^^^^^^^^^^^^
+
+If you prefer to configure your routes in your link:spring.html[Spring]
+XML file then you can use link:jsonpath.html[JSonPath] expressions as
+follows
+
+[source,xml]
+-------------------------------------------------------------------------
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <jsonpath>$.store.book[?(@.price < 10)]</jsonpath>
+ <to uri="mock:cheap"/>
+ </when>
+ <when>
+ <jsonpath>$.store.book[?(@.price < 30)]</jsonpath>
+ <to uri="mock:average"/>
+ </when>
+ <otherwise>
+ <to uri="mock:expensive"/>
+ </otherwise>
+ </choice>
+ </route>
+ </camelContext>
+-------------------------------------------------------------------------
+
+[[JSonPath-Syntax]]
+Syntax
+^^^^^^
+
+See the https://code.google.com/p/json-path/[JSonPath] project page for
+further examples.
+
+[[JSonPath-Suppressexceptions]]
+Suppress exceptions
+~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.16*
+
+By default jsonpath will throw an exception if the json payload does not
+have a valid path accordingly to the configured jsonpath expression. In
+some use-cases you may want to ignore this in case the json payload
+contains optional data. Therefore you can set the option
+suppressExceptions to true to ignore this as shown:
+
+[source,java]
+---------------------------------------------------
+from("direct:start")
+ .choice()
+ // use true to suppress exceptions
+ .when().jsonpath("person.middlename", true)
+ .to("mock:middle")
+ .otherwise()
+ .to("mock:other");
+---------------------------------------------------
+
+And in XML DSL:
+
+[source,xml]
+--------------------------------------------------------------------------
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <jsonpath suppressExceptions="true">person.middlename</jsonpath>
+ <to uri="mock:middle"/>
+ </when>
+ <otherwise>
+ <to uri="mock:other"/>
+ </otherwise>
+ </choice>
+ </route>
+--------------------------------------------------------------------------
+
+�
+
+This option is also available on the�`@JsonPath`�annotation.
+
+[[JSonPath-InlineSimple]]
+Inline Simple exceptions
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.18*
+
+Its now possible to inlined Simple language expressions in the JSonPath expression using the simple syntax ${xxx}.
+An example is shown below:
+
+[source,java]
+---------------------------------------------------
+from("direct:start")
+ .choice()
+ .when().jsonpath("$.store.book[?(@.price < ${header.cheap})]")
+ .to("mock:cheap")
+ .when().jsonpath("$.store.book[?(@.price < ${header.average})]")
+ .to("mock:average")
+ .otherwise()
+ .to("mock:expensive");
+---------------------------------------------------
+
+And in XML DSL:
+
+[source,xml]
+--------------------------------------------------------------------------
+<route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <jsonpath>$.store.book[?(@.price < ${header.cheap})]</jsonpath>
+ <to uri="mock:cheap"/>
+ </when>
+ <when>
+ <jsonpath>$.store.book[?(@.price < ${header.average})]</jsonpath>
+ <to uri="mock:average"/>
+ </when>
+ <otherwise>
+ <to uri="mock:expensive"/>
+ </otherwise>
+ </choice>
+</route>
+--------------------------------------------------------------------------
+
+You can turn off support for inlined simple expression by setting the option allowSimple to false as shown:
+
+[source,java]
+---------------------------------------------------
+.when().jsonpath("$.store.book[?(@.price < 10)]", false, false)
+---------------------------------------------------
+
+And in XML DSL:
+
+[source,xml]
+--------------------------------------------------------------------------
+<jsonpath allowSimple="false">$.store.book[?(@.price < 10)]</jsonpath>
+--------------------------------------------------------------------------
+
+
+[[JSonPath-JSonPathinjection]]
+JSonPath injection
+~~~~~~~~~~~~~~~~~~
+
+You can use link:bean-integration.html[Bean Integration] to invoke a
+method on a bean and use various languages such as JSonPath to extract a
+value from the message and bind it to a method parameter.
+
+For example
+
+[source,java]
+---------------------------------------------------------------------------------------------------
+public class Foo {
+
+ @Consume(uri = "activemq:queue:books.new")
+ public void doSomething(@JsonPath("$.store.book[*].author") String author, @Body String json) {
+ // process the inbound message here
+ }
+}
+---------------------------------------------------------------------------------------------------
+
+[[JSonPath-EncodingDetection]]
+Encoding Detection
+~~~~~~~~~~~~~~~~~~
+
+*Since Camel version 2.16*, the encoding of the JSON document is
+detected automatically, if the document is encoded in unicode �(UTF-8,
+UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE ) as specified in �RFC-4627. If
+the encoding is a non-unicode encoding, you can either make sure that
+you enter the document in String format to the JSONPath component or you
+can specify the encoding in the header�"*CamelJsonPathJsonEncoding*"
+(JsonpathConstants.HEADER_JSON_ENCODING).
+
+[[JSonPath-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use JSonPath in your camel routes you need to add the a dependency on
+*camel-jsonpath* which implements the JSonPath language.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,xml]
+-----------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jsonpath</artifactId>
+ <version>x.x.x</version>
+</dependency>
+-----------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-jsonpath/src/main/docs/jsonpath.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jsonpath/src/main/docs/jsonpath.adoc b/components/camel-jsonpath/src/main/docs/jsonpath.adoc
deleted file mode 100644
index 9f35bc1..0000000
--- a/components/camel-jsonpath/src/main/docs/jsonpath.adoc
+++ /dev/null
@@ -1,214 +0,0 @@
-[[JSonPath-JSonPath]]
-JSonPath
-~~~~~~~~
-
-*Available as of Camel 2.13*
-
-Camel supports https://code.google.com/p/json-path/[JSonPath] to allow
-using link:expression.html[Expression] or link:predicate.html[Predicate]
-on json messages.
-
-[source,java]
------------------------------------------------------
-from("queue:books.new")
- .choice()
- .when().jsonpath("$.store.book[?(@.price < 10)]")
- .to("jms:queue:book.cheap")
- .when().jsonpath("$.store.book[?(@.price < 30)]")
- .to("jms:queue:book.average")
- .otherwise()
- .to("jms:queue:book.expensive")
------------------------------------------------------
-
-[[JSonPath-UsingXMLconfiguration]]
-Using XML configuration
-^^^^^^^^^^^^^^^^^^^^^^^
-
-If you prefer to configure your routes in your link:spring.html[Spring]
-XML file then you can use link:jsonpath.html[JSonPath] expressions as
-follows
-
-[source,xml]
--------------------------------------------------------------------------
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <choice>
- <when>
- <jsonpath>$.store.book[?(@.price < 10)]</jsonpath>
- <to uri="mock:cheap"/>
- </when>
- <when>
- <jsonpath>$.store.book[?(@.price < 30)]</jsonpath>
- <to uri="mock:average"/>
- </when>
- <otherwise>
- <to uri="mock:expensive"/>
- </otherwise>
- </choice>
- </route>
- </camelContext>
--------------------------------------------------------------------------
-
-[[JSonPath-Syntax]]
-Syntax
-^^^^^^
-
-See the https://code.google.com/p/json-path/[JSonPath] project page for
-further examples.
-
-[[JSonPath-Suppressexceptions]]
-Suppress exceptions
-~~~~~~~~~~~~~~~~~~~
-
-*Available as of Camel 2.16*
-
-By default jsonpath will throw an exception if the json payload does not
-have a valid path accordingly to the configured jsonpath expression. In
-some use-cases you may want to ignore this in case the json payload
-contains optional data. Therefore you can set the option
-suppressExceptions to true to ignore this as shown:
-
-[source,java]
----------------------------------------------------
-from("direct:start")
- .choice()
- // use true to suppress exceptions
- .when().jsonpath("person.middlename", true)
- .to("mock:middle")
- .otherwise()
- .to("mock:other");
----------------------------------------------------
-
-And in XML DSL:
-
-[source,xml]
---------------------------------------------------------------------------
- <route>
- <from uri="direct:start"/>
- <choice>
- <when>
- <jsonpath suppressExceptions="true">person.middlename</jsonpath>
- <to uri="mock:middle"/>
- </when>
- <otherwise>
- <to uri="mock:other"/>
- </otherwise>
- </choice>
- </route>
---------------------------------------------------------------------------
-
-�
-
-This option is also available on the�`@JsonPath`�annotation.
-
-[[JSonPath-InlineSimple]]
-Inline Simple exceptions
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-*Available as of Camel 2.18*
-
-Its now possible to inlined Simple language expressions in the JSonPath expression using the simple syntax ${xxx}.
-An example is shown below:
-
-[source,java]
----------------------------------------------------
-from("direct:start")
- .choice()
- .when().jsonpath("$.store.book[?(@.price < ${header.cheap})]")
- .to("mock:cheap")
- .when().jsonpath("$.store.book[?(@.price < ${header.average})]")
- .to("mock:average")
- .otherwise()
- .to("mock:expensive");
----------------------------------------------------
-
-And in XML DSL:
-
-[source,xml]
---------------------------------------------------------------------------
-<route>
- <from uri="direct:start"/>
- <choice>
- <when>
- <jsonpath>$.store.book[?(@.price < ${header.cheap})]</jsonpath>
- <to uri="mock:cheap"/>
- </when>
- <when>
- <jsonpath>$.store.book[?(@.price < ${header.average})]</jsonpath>
- <to uri="mock:average"/>
- </when>
- <otherwise>
- <to uri="mock:expensive"/>
- </otherwise>
- </choice>
-</route>
---------------------------------------------------------------------------
-
-You can turn off support for inlined simple expression by setting the option allowSimple to false as shown:
-
-[source,java]
----------------------------------------------------
-.when().jsonpath("$.store.book[?(@.price < 10)]", false, false)
----------------------------------------------------
-
-And in XML DSL:
-
-[source,xml]
---------------------------------------------------------------------------
-<jsonpath allowSimple="false">$.store.book[?(@.price < 10)]</jsonpath>
---------------------------------------------------------------------------
-
-
-[[JSonPath-JSonPathinjection]]
-JSonPath injection
-~~~~~~~~~~~~~~~~~~
-
-You can use link:bean-integration.html[Bean Integration] to invoke a
-method on a bean and use various languages such as JSonPath to extract a
-value from the message and bind it to a method parameter.
-
-For example
-
-[source,java]
----------------------------------------------------------------------------------------------------
-public class Foo {
-
- @Consume(uri = "activemq:queue:books.new")
- public void doSomething(@JsonPath("$.store.book[*].author") String author, @Body String json) {
- // process the inbound message here
- }
-}
----------------------------------------------------------------------------------------------------
-
-[[JSonPath-EncodingDetection]]
-Encoding Detection
-~~~~~~~~~~~~~~~~~~
-
-*Since Camel version 2.16*, the encoding of the JSON document is
-detected automatically, if the document is encoded in unicode �(UTF-8,
-UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE ) as specified in �RFC-4627. If
-the encoding is a non-unicode encoding, you can either make sure that
-you enter the document in String format to the JSONPath component or you
-can specify the encoding in the header�"*CamelJsonPathJsonEncoding*"
-(JsonpathConstants.HEADER_JSON_ENCODING).
-
-[[JSonPath-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use JSonPath in your camel routes you need to add the a dependency on
-*camel-jsonpath* which implements the JSonPath language.
-
-If you use maven you could just add the following to your pom.xml,
-substituting the version number for the latest & greatest release (see
-link:download.html[the download page for the latest versions]).
-
-[source,xml]
------------------------------------------
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jsonpath</artifactId>
- <version>x.x.x</version>
-</dependency>
------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-jxpath/src/main/docs/jxpath-language.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jxpath/src/main/docs/jxpath-language.adoc b/components/camel-jxpath/src/main/docs/jxpath-language.adoc
new file mode 100644
index 0000000..cb4f989
--- /dev/null
+++ b/components/camel-jxpath/src/main/docs/jxpath-language.adoc
@@ -0,0 +1,172 @@
+[[JXPath-JXPath]]
+JXPath
+~~~~~~
+
+Camel supports http://commons.apache.org/jxpath/[JXPath] to allow
+link:xpath.html[XPath] expressions to be used on beans in an
+link:expression.html[Expression] or link:predicate.html[Predicate] to be
+used in the link:dsl.html[DSL] or link:xml-configuration.html[Xml
+Configuration]. For example you could use JXPath to create an
+link:predicate.html[Predicate] in a link:message-filter.html[Message
+Filter] or as an link:expression.html[Expression] for a
+link:recipient-list.html[Recipient List].
+
+You can use XPath expressions directly using smart completion in your
+IDE as follows
+
+[source,java]
+---------------------------
+from("queue:foo").filter().
+ jxpath("/in/body/foo").
+ to("queue:bar")
+---------------------------
+
+[[JXPath-Options]]
+JXPath Options
+^^^^^^^^^^^^^^
+
+
+// language options: START
+The JXPath language supports 2 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| lenient | false | Boolean | Allows to turn lenient on the JXPathContext. When turned on this allows the JXPath expression to evaluate against expressions and message bodies which may be invalid / missing data. This option is by default false
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|=======================================================================
+{% endraw %}
+// language options: END
+
+
+
+[[JXPath-Variables]]
+Variables
+^^^^^^^^^
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Variable |Type |Description
+
+|*this* |Exchange |the Exchange object
+
+|in |Message |the exchange.in message
+
+|out |Message |the exchange.out message
+|=======================================================================
+
+[[JXPath-Options]]
+Options
+^^^^^^^
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Option |Type |Description
+
+|lenient |boolean |*Camel 2.11/2.10.5:* Allows to turn lenient on the JXPathContext. When
+turned on this allows the JXPath expression to evaluate against
+expressions and message bodies which may be invalid / missing data. See
+more details at the
+http://commons.apache.org/proper/commons-jxpath//users-guide.html#Lenient_Mode[JXPath
+Documentation] This option is by default false.
+|=======================================================================
+
+[[JXPath-UsingXMLconfiguration]]
+Using XML configuration
+^^^^^^^^^^^^^^^^^^^^^^^
+
+If you prefer to configure your routes in your link:spring.html[Spring]
+XML file then you can use JXPath expressions as follows
+
+[source,xml]
+---------------------------------------------------------------------------------------------------------------
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <route>
+ <from uri="activemq:MyQueue"/>
+ <filter>
+ <jxpath>in/body/name = 'James'</xpath>
+ <to uri="mqseries:SomeOtherQueue"/>
+ </filter>
+ </route>
+ </camelContext>
+</beans>
+---------------------------------------------------------------------------------------------------------------
+
+[[JXPath-Examples]]
+Examples
+^^^^^^^^
+
+Here is a simple
+http://svn.apache.org/repos/asf/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/JXPathFilterTest.java[example]
+using a JXPath expression as a predicate in a
+link:message-filter.html[Message Filter]
+
+[[JXPath-JXPathinjection]]
+JXPath injection
+~~~~~~~~~~~~~~~~
+
+You can use link:bean-integration.html[Bean Integration] to invoke a
+method on a bean and use various languages such as JXPath to extract a
+value from the message and bind it to a method parameter.
+
+For example
+
+[source,java]
+---------------------------------------------------------------------------------------------
+public class Foo {
+
+ @MessageDriven(uri = "activemq:my.queue")
+ public void doSomething(@JXPath("in/body/foo") String correlationID, @Body String body) {
+ // process the inbound message here
+ }
+}
+---------------------------------------------------------------------------------------------
+
+[[JXPath-Loadingscriptfromexternalresource]]
+Loading script from external resource
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.11*
+
+You can externalize the script and have Camel load it from a resource
+such as `"classpath:"`, `"file:"`, or `"http:"`. +
+ This is done using the following syntax: `"resource:scheme:location"`,
+eg to refer to a file on the classpath you can do:
+
+[source,java]
+----------------------------------------------------------------
+.setHeader("myHeader").jxpath("resource:classpath:myjxpath.txt")
+----------------------------------------------------------------
+
+[[JXPath-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use JXpath in your camel routes you need to add the a dependency on
+*camel-jxpath* which implements the JXpath language.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,java]
+---------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jxpath</artifactId>
+ <version>x.x.x</version>
+</dependency>
+---------------------------------------
+
+Otherwise, you'll also need
+http://repo2.maven.org/maven2/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar[Commons
+JXPath].
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-jxpath/src/main/docs/jxpath.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jxpath/src/main/docs/jxpath.adoc b/components/camel-jxpath/src/main/docs/jxpath.adoc
deleted file mode 100644
index ff962f3..0000000
--- a/components/camel-jxpath/src/main/docs/jxpath.adoc
+++ /dev/null
@@ -1,150 +0,0 @@
-[[JXPath-JXPath]]
-JXPath
-~~~~~~
-
-Camel supports http://commons.apache.org/jxpath/[JXPath] to allow
-link:xpath.html[XPath] expressions to be used on beans in an
-link:expression.html[Expression] or link:predicate.html[Predicate] to be
-used in the link:dsl.html[DSL] or link:xml-configuration.html[Xml
-Configuration]. For example you could use JXPath to create an
-link:predicate.html[Predicate] in a link:message-filter.html[Message
-Filter] or as an link:expression.html[Expression] for a
-link:recipient-list.html[Recipient List].
-
-You can use XPath expressions directly using smart completion in your
-IDE as follows
-
-[source,java]
----------------------------
-from("queue:foo").filter().
- jxpath("/in/body/foo").
- to("queue:bar")
----------------------------
-
-[[JXPath-Variables]]
-Variables
-^^^^^^^^^
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Variable |Type |Description
-
-|*this* |Exchange |the Exchange object
-
-|in |Message |the exchange.in message
-
-|out |Message |the exchange.out message
-|=======================================================================
-
-[[JXPath-Options]]
-Options
-^^^^^^^
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Option |Type |Description
-
-|lenient |boolean |*Camel 2.11/2.10.5:* Allows to turn lenient on the JXPathContext. When
-turned on this allows the JXPath expression to evaluate against
-expressions and message bodies which may be invalid / missing data. See
-more details at the
-http://commons.apache.org/proper/commons-jxpath//users-guide.html#Lenient_Mode[JXPath
-Documentation] This option is by default false.
-|=======================================================================
-
-[[JXPath-UsingXMLconfiguration]]
-Using XML configuration
-^^^^^^^^^^^^^^^^^^^^^^^
-
-If you prefer to configure your routes in your link:spring.html[Spring]
-XML file then you can use JXPath expressions as follows
-
-[source,xml]
----------------------------------------------------------------------------------------------------------------
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
- <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
- <route>
- <from uri="activemq:MyQueue"/>
- <filter>
- <jxpath>in/body/name = 'James'</xpath>
- <to uri="mqseries:SomeOtherQueue"/>
- </filter>
- </route>
- </camelContext>
-</beans>
----------------------------------------------------------------------------------------------------------------
-
-[[JXPath-Examples]]
-Examples
-^^^^^^^^
-
-Here is a simple
-http://svn.apache.org/repos/asf/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/JXPathFilterTest.java[example]
-using a JXPath expression as a predicate in a
-link:message-filter.html[Message Filter]
-
-[[JXPath-JXPathinjection]]
-JXPath injection
-~~~~~~~~~~~~~~~~
-
-You can use link:bean-integration.html[Bean Integration] to invoke a
-method on a bean and use various languages such as JXPath to extract a
-value from the message and bind it to a method parameter.
-
-For example
-
-[source,java]
----------------------------------------------------------------------------------------------
-public class Foo {
-
- @MessageDriven(uri = "activemq:my.queue")
- public void doSomething(@JXPath("in/body/foo") String correlationID, @Body String body) {
- // process the inbound message here
- }
-}
----------------------------------------------------------------------------------------------
-
-[[JXPath-Loadingscriptfromexternalresource]]
-Loading script from external resource
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.11*
-
-You can externalize the script and have Camel load it from a resource
-such as `"classpath:"`, `"file:"`, or `"http:"`. +
- This is done using the following syntax: `"resource:scheme:location"`,
-eg to refer to a file on the classpath you can do:
-
-[source,java]
-----------------------------------------------------------------
-.setHeader("myHeader").jxpath("resource:classpath:myjxpath.txt")
-----------------------------------------------------------------
-
-[[JXPath-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use JXpath in your camel routes you need to add the a dependency on
-*camel-jxpath* which implements the JXpath language.
-
-If you use maven you could just add the following to your pom.xml,
-substituting the version number for the latest & greatest release (see
-link:download.html[the download page for the latest versions]).
-
-[source,java]
----------------------------------------
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jxpath</artifactId>
- <version>x.x.x</version>
-</dependency>
----------------------------------------
-
-Otherwise, you'll also need
-http://repo2.maven.org/maven2/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar[Commons
-JXPath].
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-ognl/src/main/docs/ognl-language.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ognl/src/main/docs/ognl-language.adoc b/components/camel-ognl/src/main/docs/ognl-language.adoc
new file mode 100644
index 0000000..8edf054
--- /dev/null
+++ b/components/camel-ognl/src/main/docs/ognl-language.adoc
@@ -0,0 +1,138 @@
+[[OGNL-OGNL]]
+OGNL
+~~~~
+
+Camel allows http://commons.apache.org/proper/commons-ognl/[OGNL] to be
+used as an link:expression.html[Expression] or
+link:predicate.html[Predicate] the link:dsl.html[DSL] or
+link:xml-configuration.html[Xml Configuration].
+
+You could use OGNL to create an link:predicate.html[Predicate] in a
+link:message-filter.html[Message Filter] or as an
+link:expression.html[Expression] for a
+link:recipient-list.html[Recipient List]
+
+You can use OGNL dot notation to invoke operations. If you for instance
+have a body that contains a POJO that has a `getFamilyName` method then
+you can construct the syntax as follows:
+
+[source,java]
+----------------------------------------
+"request.body.familyName"
+ // or
+"getRequest().getBody().getFamilyName()"
+----------------------------------------
+
+[[OGNL-Options]]
+OGNL Options
+^^^^^^^^^^^^
+
+
+// language options: START
+The OGNL language supports 1 options which are listed below.
+
+
+
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+| trim | true | Boolean | Whether to trim the value to remove leading and trailing whitespaces and line breaks
+|=======================================================================
+{% endraw %}
+// language options: END
+
+
+
+[[OGNL-Variables]]
+Variables
+^^^^^^^^^
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Variable |Type |Description
+
+|*this* |Exchange |the Exchange is the root object
+
+|exchange |Exchange |the Exchange object
+
+|exception |Throwable |the Exchange exception (if any)
+
+|exchangeId |String |the exchange id
+
+|fault |Message |the Fault message (if any)
+
+|request |Message |the exchange.in message
+
+|response |Message |the exchange.out message (if any)
+
+|properties |Map |the exchange properties
+
+|property(name) |Object |the property by the given name
+
+|property(name, type) |Type |the property by the given name as the given type
+|=======================================================================
+
+[[OGNL-Samples]]
+Samples
+^^^^^^^
+
+For example you could use OGNL inside a link:message-filter.html[Message
+Filter] in XML
+
+[source,java]
+---------------------------------------------
+<route>
+ <from uri="seda:foo"/>
+ <filter>
+ <ognl>request.headers.foo == 'bar'</ognl>
+ <to uri="seda:bar"/>
+ </filter>
+</route>
+---------------------------------------------
+
+And the sample using Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------
+ from("seda:foo").filter().ognl("request.headers.foo == 'bar'").to("seda:bar");
+---------------------------------------------------------------------------------
+
+[[OGNL-Loadingscriptfromexternalresource]]
+Loading script from external resource
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.11*
+
+You can externalize the script and have Camel load it from a resource
+such as `"classpath:"`, `"file:"`, or `"http:"`. +
+ This is done using the following syntax: `"resource:scheme:location"`,
+eg to refer to a file on the classpath you can do:
+
+[source,java]
+------------------------------------------------------------
+.setHeader("myHeader").ognl("resource:classpath:myognl.txt")
+------------------------------------------------------------
+
+[[OGNL-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use OGNL in your camel routes you need to add the a dependency on
+*camel-ognl* which implements the OGNL language.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,java]
+-------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-ognl</artifactId>
+ <version>x.x.x</version>
+</dependency>
+-------------------------------------
+
+Otherwise, you'll also need
+http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ognl/2.7.3_4/org.apache.servicemix.bundles.ognl-2.7.3_4.jar[OGNL]
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/components/camel-ognl/src/main/docs/ognl.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ognl/src/main/docs/ognl.adoc b/components/camel-ognl/src/main/docs/ognl.adoc
deleted file mode 100644
index c3d6344..0000000
--- a/components/camel-ognl/src/main/docs/ognl.adoc
+++ /dev/null
@@ -1,117 +0,0 @@
-[[OGNL-OGNL]]
-OGNL
-~~~~
-
-Camel allows http://commons.apache.org/proper/commons-ognl/[OGNL] to be
-used as an link:expression.html[Expression] or
-link:predicate.html[Predicate] the link:dsl.html[DSL] or
-link:xml-configuration.html[Xml Configuration].
-
-You could use OGNL to create an link:predicate.html[Predicate] in a
-link:message-filter.html[Message Filter] or as an
-link:expression.html[Expression] for a
-link:recipient-list.html[Recipient List]
-
-You can use OGNL dot notation to invoke operations. If you for instance
-have a body that contains a POJO that has a `getFamilyName` method then
-you can construct the syntax as follows:
-
-[source,java]
-----------------------------------------
-"request.body.familyName"
- // or
-"getRequest().getBody().getFamilyName()"
-----------------------------------------
-
-[[OGNL-Variables]]
-Variables
-^^^^^^^^^
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Variable |Type |Description
-
-|*this* |Exchange |the Exchange is the root object
-
-|exchange |Exchange |the Exchange object
-
-|exception |Throwable |the Exchange exception (if any)
-
-|exchangeId |String |the exchange id
-
-|fault |Message |the Fault message (if any)
-
-|request |Message |the exchange.in message
-
-|response |Message |the exchange.out message (if any)
-
-|properties |Map |the exchange properties
-
-|property(name) |Object |the property by the given name
-
-|property(name, type) |Type |the property by the given name as the given type
-|=======================================================================
-
-[[OGNL-Samples]]
-Samples
-^^^^^^^
-
-For example you could use OGNL inside a link:message-filter.html[Message
-Filter] in XML
-
-[source,java]
----------------------------------------------
-<route>
- <from uri="seda:foo"/>
- <filter>
- <ognl>request.headers.foo == 'bar'</ognl>
- <to uri="seda:bar"/>
- </filter>
-</route>
----------------------------------------------
-
-And the sample using Java DSL:
-
-[source,java]
----------------------------------------------------------------------------------
- from("seda:foo").filter().ognl("request.headers.foo == 'bar'").to("seda:bar");
----------------------------------------------------------------------------------
-
-[[OGNL-Loadingscriptfromexternalresource]]
-Loading script from external resource
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.11*
-
-You can externalize the script and have Camel load it from a resource
-such as `"classpath:"`, `"file:"`, or `"http:"`. +
- This is done using the following syntax: `"resource:scheme:location"`,
-eg to refer to a file on the classpath you can do:
-
-[source,java]
-------------------------------------------------------------
-.setHeader("myHeader").ognl("resource:classpath:myognl.txt")
-------------------------------------------------------------
-
-[[OGNL-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use OGNL in your camel routes you need to add the a dependency on
-*camel-ognl* which implements the OGNL language.
-
-If you use maven you could just add the following to your pom.xml,
-substituting the version number for the latest & greatest release (see
-link:download.html[the download page for the latest versions]).
-
-[source,java]
--------------------------------------
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-ognl</artifactId>
- <version>x.x.x</version>
-</dependency>
--------------------------------------
-
-Otherwise, you'll also need
-http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ognl/2.7.3_4/org.apache.servicemix.bundles.ognl-2.7.3_4.jar[OGNL]
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
index f4f85fb..73f1d82 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
@@ -30,6 +30,8 @@ import org.apache.camel.maven.packaging.model.ComponentOptionModel;
import org.apache.camel.maven.packaging.model.DataFormatModel;
import org.apache.camel.maven.packaging.model.DataFormatOptionModel;
import org.apache.camel.maven.packaging.model.EndpointOptionModel;
+import org.apache.camel.maven.packaging.model.LanguageModel;
+import org.apache.camel.maven.packaging.model.LanguageOptionModel;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -85,6 +87,7 @@ public class ReadmeComponentMojo extends AbstractMojo {
public void execute() throws MojoExecutionException, MojoFailureException {
executeComponent();
executeDataFormat();
+ executeLanguage();
}
private void executeComponent() throws MojoExecutionException, MojoFailureException {
@@ -162,6 +165,42 @@ public class ReadmeComponentMojo extends AbstractMojo {
}
}
+ private void executeLanguage() throws MojoExecutionException, MojoFailureException {
+ // find the language names
+ List<String> languageNames = findLanguageNames();
+
+ final Set<File> jsonFiles = new TreeSet<File>();
+ PackageHelper.findJsonFiles(buildDir, jsonFiles, new PackageHelper.CamelComponentsModelFilter());
+
+ // only if there is language we should update the documentation files
+ if (!languageNames.isEmpty()) {
+ getLog().debug("Found " + languageNames.size() + " languages");
+ for (String languageName : languageNames) {
+ String json = loadLanguageJson(jsonFiles, languageName);
+ if (json != null) {
+ File file = new File(docDir, languageName + "-language.adoc");
+
+ LanguageModel model = generateLanguageModel(languageName, json);
+
+ boolean exists = file.exists();
+ boolean updated = false;
+ if (model.getLanguageOptions() != null) {
+ String options = templateLanguageOptions(model);
+ updated |= updateLanguageOptions(file, options);
+ }
+
+ if (updated) {
+ getLog().info("Updated doc file: " + file);
+ } else if (exists) {
+ getLog().debug("No changes to doc file: " + file);
+ } else {
+ getLog().warn("No language doc file: " + file);
+ }
+ }
+ }
+ }
+ }
+
private boolean updateComponentOptions(File file, String changed) throws MojoExecutionException {
if (!file.exists()) {
return false;
@@ -264,6 +303,40 @@ public class ReadmeComponentMojo extends AbstractMojo {
}
}
+ private boolean updateLanguageOptions(File file, String changed) throws MojoExecutionException {
+ if (!file.exists()) {
+ return false;
+ }
+
+ try {
+ String text = loadText(new FileInputStream(file));
+
+ String existing = StringHelper.between(text, "// language options: START", "// language options: END");
+ if (existing != null) {
+ // remove leading line breaks etc
+ existing = existing.trim();
+ changed = changed.trim();
+ if (existing.equals(changed)) {
+ return false;
+ } else {
+ String before = StringHelper.before(text, "// language options: START");
+ String after = StringHelper.after(text, "// language options: END");
+ text = before + "\n// language options: START\n" + changed + "\n// language options: END\n" + after;
+ writeText(file, text);
+ return true;
+ }
+ } else {
+ getLog().warn("Cannot find markers in file " + file);
+ getLog().warn("Add the following markers");
+ getLog().warn("\t// language options: START");
+ getLog().warn("\t// language options: END");
+ return false;
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException("Error reading file " + file + " Reason: " + e, e);
+ }
+ }
+
private String loadComponentJson(Set<File> jsonFiles, String componentName) {
try {
for (File file : jsonFiles) {
@@ -298,6 +371,23 @@ public class ReadmeComponentMojo extends AbstractMojo {
return null;
}
+ private String loadLanguageJson(Set<File> jsonFiles, String languageName) {
+ try {
+ for (File file : jsonFiles) {
+ if (file.getName().equals(languageName + ".json")) {
+ String json = loadText(new FileInputStream(file));
+ boolean isLanguage = json.contains("\"kind\": \"language\"");
+ if (isLanguage) {
+ return json;
+ }
+ }
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ return null;
+ }
+
private ComponentModel generateComponentModel(String componentName, String json) {
List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("component", json, false);
@@ -391,6 +481,43 @@ public class ReadmeComponentMojo extends AbstractMojo {
return dataFormat;
}
+ private LanguageModel generateLanguageModel(String languageName, String json) {
+ List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("language", json, false);
+
+ LanguageModel language = new LanguageModel();
+ language.setTitle(JSonSchemaHelper.getSafeValue("title", rows));
+ language.setModelName(JSonSchemaHelper.getSafeValue("modelName", rows));
+ language.setDescription(JSonSchemaHelper.getSafeValue("description", rows));
+ language.setLabel(JSonSchemaHelper.getSafeValue("label", rows));
+ language.setDeprecated(JSonSchemaHelper.getSafeValue("deprecated", rows));
+ language.setJavaType(JSonSchemaHelper.getSafeValue("javaType", rows));
+ language.setGroupId(JSonSchemaHelper.getSafeValue("groupId", rows));
+ language.setArtifactId(JSonSchemaHelper.getSafeValue("artifactId", rows));
+ language.setVersion(JSonSchemaHelper.getSafeValue("version", rows));
+
+ rows = JSonSchemaHelper.parseJsonSchema("properties", json, true);
+ for (Map<String, String> row : rows) {
+ LanguageOptionModel option = new LanguageOptionModel();
+ option.setName(getSafeValue("name", row));
+ option.setKind(getSafeValue("kind", row));
+ option.setType(getSafeValue("type", row));
+ option.setJavaType(getSafeValue("javaType", row));
+ option.setDeprecated(getSafeValue("deprecated", row));
+ option.setEnumValues(getSafeValue("enum", row));
+ option.setDefaultValue(getSafeValue("defaultValue", row));
+ option.setDescription(getSafeValue("description", row));
+
+ // skip option named id/expression
+ if ("id".equals(option.getName()) || "expression".equals(option.getName())) {
+ getLog().debug("Skipping option: " + option.getName());
+ } else {
+ language.addLanguageOption(option);
+ }
+ }
+
+ return language;
+ }
+
private String templateComponentHeader(ComponentModel model) throws MojoExecutionException {
try {
String template = loadText(ReadmeComponentMojo.class.getClassLoader().getResourceAsStream("component-header.mvel"));
@@ -431,6 +558,16 @@ public class ReadmeComponentMojo extends AbstractMojo {
}
}
+ private String templateLanguageOptions(LanguageModel model) throws MojoExecutionException {
+ try {
+ String template = loadText(ReadmeComponentMojo.class.getClassLoader().getResourceAsStream("language-options.mvel"));
+ String out = (String) TemplateRuntime.eval(template, model);
+ return out;
+ } catch (Exception e) {
+ throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
+ }
+ }
+
private List<String> findComponentNames() {
List<String> componentNames = new ArrayList<String>();
for (Resource r : project.getBuild().getResources()) {
@@ -487,4 +624,32 @@ public class ReadmeComponentMojo extends AbstractMojo {
return dataFormatNames;
}
+ private List<String> findLanguageNames() {
+ List<String> languageNames = new ArrayList<String>();
+ for (Resource r : project.getBuild().getResources()) {
+ File f = new File(r.getDirectory());
+ if (!f.exists()) {
+ f = new File(project.getBasedir(), r.getDirectory());
+ }
+ f = new File(f, "META-INF/services/org/apache/camel/language");
+
+ if (f.exists() && f.isDirectory()) {
+ File[] files = f.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ // skip directories as there may be a sub .resolver directory
+ if (file.isDirectory()) {
+ continue;
+ }
+ String name = file.getName();
+ if (name.charAt(0) != '.') {
+ languageNames.add(name);
+ }
+ }
+ }
+ }
+ }
+ return languageNames;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-header.mvel
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-header.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-header.mvel
deleted file mode 100644
index be348c6..0000000
--- a/tooling/maven/camel-package-maven-plugin/src/main/resources/dataformat-header.mvel
+++ /dev/null
@@ -1,15 +0,0 @@
-# @{title}
-
-@{description}
-
-### Maven Dependency
-
-Maven users would need to add dependency:
-
-```xml
- <dependency>
- <groupId>${groupId}</groupId>
- <artifactId>${artifactId}</artifactId>
- <version>${version}</version>
- </dependency>
-```
http://git-wip-us.apache.org/repos/asf/camel/blob/536ec533/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..f64fb71
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/language-options.mvel
@@ -0,0 +1,15 @@
+@if{languageOptions.isEmpty()}
+The @{title} language has no options.
+@else{}
+The @{title} language supports @{languageOptions.size()} options which are listed below.
+@end{}
+
+@if{!languageOptions.isEmpty()}
+{% raw %}
+[width="100%",cols="2s,1m,1m,6",options="header"]
+|=======================================================================
+| Name | Default | Java Type | Description
+@foreach{row : languageOptions}| @{row.name} | @{row.defaultValue} | @{row.shortJavaType} | @{row.description}
+@end{}|=======================================================================
+{% endraw %}
+@end{}
\ No newline at end of file