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 2021/08/17 07:30:14 UTC
[camel] 07/15: Polish and cleanup documentation
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a8960f4941d12987d1b4b68af6d0d0f1ca1de381
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 16 17:03:33 2021 +0200
Polish and cleanup documentation
---
docs/user-manual/modules/ROOT/nav.adoc | 1 -
docs/user-manual/modules/ROOT/pages/index.adoc | 1 -
.../modules/ROOT/pages/transformer.adoc | 74 ++++++++++------------
docs/user-manual/modules/ROOT/pages/transport.adoc | 21 ------
.../modules/faq/pages/what-is-camel.adoc | 4 +-
5 files changed, 35 insertions(+), 66 deletions(-)
diff --git a/docs/user-manual/modules/ROOT/nav.adoc b/docs/user-manual/modules/ROOT/nav.adoc
index 2cad1a5..eb6362b 100644
--- a/docs/user-manual/modules/ROOT/nav.adoc
+++ b/docs/user-manual/modules/ROOT/nav.adoc
@@ -76,7 +76,6 @@
** xref:transformer.adoc[Transformer]
** xref:threading-model.adoc[Threading Model]
** xref:tracer.adoc[Tracer]
-** xref:transport.adoc[Transport]
** xref:type-converter.adoc[Type Converter]
** xref:uris.adoc[URIs]
** xref:uuidgenerator.adoc[UuidGenerator]
diff --git a/docs/user-manual/modules/ROOT/pages/index.adoc b/docs/user-manual/modules/ROOT/pages/index.adoc
index 44bc857..ae53a1a 100644
--- a/docs/user-manual/modules/ROOT/pages/index.adoc
+++ b/docs/user-manual/modules/ROOT/pages/index.adoc
@@ -106,7 +106,6 @@ For a deeper and better understanding of Apache Camel, an xref:faq:what-is-camel
* xref:stream-caching.adoc[Stream caching]
* xref:threading-model.adoc[Threading Model]
* xref:tracer.adoc[Tracer]
-* xref:transport.adoc[Transport]
* xref:type-converter.adoc[Type Converter]
* xref:uris.adoc[URIs]
* xref:uuidgenerator.adoc[UuidGenerator]
diff --git a/docs/user-manual/modules/ROOT/pages/transformer.adoc b/docs/user-manual/modules/ROOT/pages/transformer.adoc
index f3e5f5d..4af8a9f 100644
--- a/docs/user-manual/modules/ROOT/pages/transformer.adoc
+++ b/docs/user-manual/modules/ROOT/pages/transformer.adoc
@@ -1,76 +1,64 @@
[[Transformer-Transformer]]
= Transformer
-*Since Camel 2.19*
-
-Transformer performs declarative transformation of the message according
-to the declared `Input Type` and/or `Output Type` on a route definition which declares
-the expected message type.
-The default camel Message implements `DataTypeAware`, which allows to hold the message type
+Transformer (`org.apache.camel.spi.Transformer`) performs declarative transformation of the message according
+to the declared _Input Type_ and/or _Output Type_ on a route definition which declares
+the expected message type. The default camel Message implements `DataTypeAware`, which allows to hold the message type
represented by `DataType`.
-If the input type and/or output type is declared by `Input Type` and/or `Output Type` in the route
+
+If the input type and/or output type is declared by _Input Type_ and/or _Output Type_ in the route
definition, and it is different from actual message type at runtime, camel internal processor
-looks for a Transformer which transforms from the current message type to the expected message
+looks for a `Transformer` which transforms from the current message type to the expected message
type and apply. Once transform succeed or message is already in expected type, then the message
- data type is updated.
-
+data type is updated.
-
-[[Transformer-DataTypeFormat]]
== Data type format
-[source]
+
+[source,text]
----
scheme:name
----
+
where *scheme* is the type of data model like `java`, `xml` or `json`, and *name* is the individual
data type name. If you only specify *scheme* then it hits all the data types which has that scheme like
a wildcard.
-
-
-[[Transformer-SupportedTransformers]]
== Supported Transformers
+[width="100%",cols="25%,75%",options="header",]
|===
| Transformer | Description
-
| Data Format Transformer | Transform with using Data Format
-
| Endpoint Transformer | Transform with using Endpoint
-
| Custom Transformer | Transform with using custom transformer class. Transformer must be a subclass of `org.apache.camel.spi.Transformer`
|===
-
-
-[[Transformer-CommonOptions]]
=== Common Options
+
All transformers have following common options to specify which data type is supported by the transformer. `scheme` or both of `fromType` and `toType` must be specified.
+
+[width="100%",cols="25%,75%",options="header",]
|===
| Name | Description
-
| scheme | Type of data model like `xml` or `json`. For example if `xml` is specified, the transformer is applied for all java -> xml and xml -> java transformation.
-
| fromType | xref:transformer.adoc[Data type] to transform from.
-
| toType | xref:transformer.adoc[Data type] to transform to.
|===
-
-[[Transformer-DataFormat]]
=== DataFormat Transformer Options
+
+[width="100%",cols="25%,75%",options="header",]
|===
| Name | Description
-
| type | Data Format type
-
| ref | reference to the Data Format ID
|===
-Here is an example to specify bindy DataFormat type:
+Here is an example to specify xref:components:dataformats:bindy-dataformat.adoc[Bindy] DataFormat type:
Java DSL:
+
[source,java]
----
BindyDataFormat bindy = new BindyDataFormat();
@@ -83,6 +71,7 @@ transformer()
----
XML DSL:
+
[source,xml]
----
<dataFormatTransformer fromType="java:com.example.Order" toType="csv:CSVOrder">
@@ -90,14 +79,12 @@ XML DSL:
</dataFormatTransformer>
----
-
-[[Transformer-Endpoint]]
== Endpoint Transformer Options
+
+[width="100%",cols="25%,75%",options="header",]
|===
| Name | Description
-
| ref | Reference to the Endpoint ID
-
| uri | Endpoint URI
|===
@@ -112,25 +99,27 @@ transformer()
----
And here is an example to specify endpoint ref in XML DSL:
+
[source,xml]
----
<endpointTransformer ref="myDozerEndpoint" fromType="xml" toType="json"/>
----
-[[Transformer-Custom]]
== Custom Transformer Options
+
Note that Transformer must be a subclass of `org.apache.camel.spi.Transformer`
+
+[width="100%",cols="25%,75%",options="header",]
|===
| Name | Description
-
| ref | Reference to the custom Transformer bean ID
-
| className | Fully qualified class name of the custom Transformer class
|===
Here is an example to specify custom Transformer class:
Java DSL:
+
[source,java]
----
transformer()
@@ -140,20 +129,19 @@ transformer()
----
XML DSL:
+
[source,xml]
----
<customTransformer className="com.example.MyCustomTransformer" fromType="xml" toType="json"/>
----
-
-
-[[Transformer-Examples]]
-== Examples
+== Example
For example to declare the Endpoint Transformer which uses
xslt component to transform from `xml:ABCOrder` to `xml:XYZOrder`, we can do as follows:
Java DSL:
+
[source,java]
-------------------------------------------------------------------
transformer()
@@ -163,6 +151,7 @@ transformer()
-------------------------------------------------------------------
XML DSL:
+
[source,xml]
-------------------------------------------------------------------
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
@@ -176,17 +165,20 @@ XML DSL:
If you have following route definition, above transformer will be applied when `direct:abc` endpoint sends the message to `direct:xyz`:
Java DSL:
+
[source,java]
-------------------------------------------------------------------
from("direct:abc")
.inputType("xml:ABCOrder")
.to("direct:xyz");
+
from("direct:xyz")
.inputType("xml:XYZOrder")
.to("somewhere:else");
-------------------------------------------------------------------
XML DSL:
+
[source,xml]
-------------------------------------------------------------------
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
diff --git a/docs/user-manual/modules/ROOT/pages/transport.adoc b/docs/user-manual/modules/ROOT/pages/transport.adoc
deleted file mode 100644
index 1af3d2e..0000000
--- a/docs/user-manual/modules/ROOT/pages/transport.adoc
+++ /dev/null
@@ -1,21 +0,0 @@
-[[Transport-Transports]]
-= Transports
-
-Apache Camel supports a number of different plugable componets for
-talking to different transports. The transports is implement as Camel
-components.
-
-[[Transport-ComponentsIncluded]]
-== Components Included
-
-Camel includes the following Component implementations via xref:uris.adoc[URIs].
-
-[IMPORTANT]
-====
-Make sure to read xref:faq:how-do-i-configure-endpoints.adoc[How do I configure endpoints?]
-to learn more about configuring endpoints. For
-example how to refer to beans in the xref:registry.adoc[Registry] or how
-to use raw values for password options, and using
-xref:using-propertyplaceholder.adoc[property placeholders] etc.
-====
-
diff --git a/docs/user-manual/modules/faq/pages/what-is-camel.adoc b/docs/user-manual/modules/faq/pages/what-is-camel.adoc
index aed1f87..b57c089 100644
--- a/docs/user-manual/modules/faq/pages/what-is-camel.adoc
+++ b/docs/user-manual/modules/faq/pages/what-is-camel.adoc
@@ -11,7 +11,7 @@ This means you get smart completion of
routing rules in your IDE, whether in a Java or XML editor.
Apache Camel uses xref:ROOT:uris.adoc[URIs] to work directly with any kind of
-xref:ROOT:transport.adoc[Transport] or messaging model such as
+transport or messaging model such as
xref:components::http-component.adoc[HTTP], xref:components::activemq-component.adoc[ActiveMQ], xref:components::jms-component.adoc[JMS],
JBI, SCA, xref:components::mina-component.adoc[MINA] or xref:components::cxf-component.adoc[CXF], as
well as pluggable xref:ROOT:component.adoc[Components] and
@@ -19,7 +19,7 @@ xref:ROOT:data-format.adoc[Data Format] options. Apache Camel is a small
library with minimal xref:ROOT:what-are-the-dependencies.adoc[dependencies]
for easy embedding in any Java application. Apache Camel lets you work
with the same xref:ROOT:exchange.adoc[API] regardless which kind of
-xref:ROOT:transport.adoc[Transport] is used -- so learn the API once and you
+transport is used -- so learn the API once and you
can interact with all the xref:components::index.adoc[Components] provided
out-of-box.