camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] camel git commit: CAMEL-9541: Generate readme for dataformat also.
Date Tue, 16 Aug 2016 09:17:09 GMT
http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-csv/src/main/docs/csv.adoc
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/main/docs/csv.adoc b/components/camel-csv/src/main/docs/csv.adoc
deleted file mode 100644
index 5d56296..0000000
--- a/components/camel-csv/src/main/docs/csv.adoc
+++ /dev/null
@@ -1,465 +0,0 @@
-[[CSV-CSV]]
-CSV
-~~~
-
-The CSV link:data-format.html[Data Format] uses
-http://commons.apache.org/proper/commons-csv/[Apache Commons CSV] to
-handle CSV payloads (Comma Separated Values) such as those
-exported/imported by Excel.
-
-As of Camel 2.15.0, it now uses
-the http://commons.apache.org/proper/commons-csv/archives/1.1/index.html[Apache
-Commons CSV 1.1] which is based on a completely different set of
-options.
-
-[[CSV-AvailableoptionsuntilCamel2.15]]
-Available options until Camel 2.15
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Option |Type |Description
-
-|config |CSVConfig |Can be used to set a custom `CSVConfig` object.
-
-|strategy |CSVStrategy |Can be used to set a custom `CSVStrategy`; the default is
-`CSVStrategy.DEFAULT_STRATEGY`.
-
-|autogenColumns |boolean |Whether or not columns are auto-generated in the resulting CSV. The
-default value is `true`; subsequent messages use the previously created
-columns with new fields being added at the end of the line.
-
-|delimiter |String |*Camel 2.4:* The column delimiter to use; the default value is "`,`".
-
-|skipFirstLine |boolean |*Camel 2.10:* Whether or not to skip the first line of CSV input when
-unmarshalling (e.g. if the content has headers on the first line); the
-default value is `false`.
-
-|lazyLoad |boolean |*Camel 2.12.2:* Whether or not to Sequential access CSV input through an
-iterator which could avoid OOM exception when processing huge CSV file;
-the default value is false
-
-|useMaps |boolean |*Camel 2.13:* Whether to use List<Map> when unmarshalling instead of
-List<List>.
-|=======================================================================
-
-[[CSV-AvailableoptionsasofCamel2.15]]
-Available options as of Camel 2.15
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Option |Type |Description
-
-|`format` |`CSVFormat` |The reference format to use, it will be updated with the other format
-options, the default value is `CSVFormat.DEFAULT`
-
-|`commentMarkerDisabled` |`boolean` |Disables the comment marker of the reference format.
-This option is `false` by default.
-
-|`commentMarker` |`Character` |Overrides the comment marker of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `null` for `CSVFormat.DEFAULT`.
-
-|`delimiter` |`Character` |Overrides the delimiter of the reference format.
-This option is `null` by defaut. When `null` it keeps the value of the
-reference format which is `','` for `CSVFormat.DEFAULT`.
-
-|`escapeDisabled` |`boolean` |Disables the escape character of the reference format.
-This option is `false` by default.
-
-|`escape` |`Character` |Overrides the escape character of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `null` for `CSVFormat.DEFAULT`.
-
-|`headerDisabled` |`boolean` |Disables the header of the reference format.
-This option is `false` by default.
-
-|`header` |`String[]` |Overrides the header of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `null` for `CSVFormat.DEFAULT`.
-
-|`allowMissingColumnNames` |`Boolean` |Overrides the missing column names behavior of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `false` for `CSVFormat.DEFAULT`.
-
-|`ignoreEmptyLines` |`Boolean` |Overrides the empty line behavior of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `true` for `CSVFormat.DEFAULT`.
-
-|`ignoreSurroundingSpaces` |`Boolean` |Overrides the surrounding spaces behavior of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `false` for `CSVFormat.DEFAULT`.
-
-|`nullStringDisabled` |`boolean` |Disables the null string representation of the reference format.
-This option is `false` by default.
-
-|`nullString` |`String` |Overrides the null string representation of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `null` for `CSVFormat.DEFAULT`.
-
-|`quoteDisabled` |`boolean` |Disables the quote of the reference format.
-This option is `false` by default.
-
-|`quote` |`Character` |Overrides the quote symbol of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `'"'` (double quote) for `CSVFormat.DEFAULT`.
-
-|`quoteMode` |`QuoteMode` |Overrides the quote mode of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `null` for `CSVFormat.DEFAULT`.
-
-|`recordSeparatorDisabled` |`boolean` |Disables the record separator of the reference format.
-This option is `false` by default.
-
-|`recordSeparator` |`String` |Overrides the record separator of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `\r\n` (CRLF) for `CSVFormat.DEFAULT`.
-
-|`skipHeaderRecord` |`Boolean` |Overrides the header record behavior of the reference format.
-This option is `null` by default. When `null` it keeps the value of the
-reference format which is `false` for `CSVFormat.DEFAULT`.
-
-|`lazyLoad` |`boolean` |Whether the unmarshalling should produce an iterator that reads the
-lines on the fly or if all the lines must be read at one.
-This option is `false` by default.
-
-|`useMaps` |`boolean` |Whether the unmarshalling should produce maps for the lines values
-instead of lists. It requires to have header (either defined or
-collected). This options is `false` by default.
-
-|`recordConverter` |`CsvRecordConverter` |Sets the record converter to use. If defines the `useMaps` options is
-disabled. This option is `null` by default.
-|=======================================================================
-
-[[CSV-MarshallingaMaptoCSV]]
-Marshalling a Map to CSV
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-The component allows you to marshal a Java Map (or any other message
-type that can be link:type-converter.html[converted] in a Map) into a
-CSV payload.
-
-Considering the following body 
-
-[source,java]
--------------------------------------------------------
-Map<String, Object> body = new LinkedHashMap<>();
-body.put("foo", "abc");
-body.put("bar", 123);
--------------------------------------------------------
-
-and this Java route definition 
-
-[source,java]
--------------------------------------------------------
-from("direct:start")
-    .marshal().csv()
-    .to("mock:result");
--------------------------------------------------------
-
-or this XML route definition 
-
-[source,xml]
--------------------------------------------------------
-<route>
-    <from uri="direct:start" />
-    <marshal>
-        <csv />
-    </marshal>
-    <to uri="mock:result" />
-</route>
--------------------------------------------------------
-
-then it will produce 
-
-[source,java]
--------------------------------------------------------
-abc,123
--------------------------------------------------------
-
-[[CSV-UnmarshallingaCSVmessageintoaJavaList]]
-Unmarshalling a CSV message into a Java List
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Unmarshalling will transform a CSV messsage into a Java List with CSV
-file lines (containing another List with all the field values).
-
-An example: we have a CSV file with names of persons, their IQ and their
-current activity.
-
-[source,text]
------------------------------------------------------
-Jack Dalton, 115, mad at Averell
-Joe Dalton, 105, calming Joe
-William Dalton, 105, keeping Joe from killing Averell
-Averell Dalton, 80, playing with Rantanplan
-Lucky Luke, 120, capturing the Daltons
------------------------------------------------------
-
-We can now use the CSV component to unmarshal this file:
-
-[source,java]
----------------------------------------------------------------
-from("file:src/test/resources/?fileName=daltons.csv&noop=true")
-    .unmarshal().csv()
-    .to("mock:daltons");
----------------------------------------------------------------
-
-The resulting message will contain a `List<List<String>>` like...
-
-[source,java]
---------------------------------------------------------------------------------------------------------------
-List<List<String>> data = (List<List<String>>) exchange.getIn().getBody();
-for (List<String> line : data) {
-    LOG.debug(String.format("%s has an IQ of %s and is currently %s", line.get(0), line.get(1), line.get(2)));
-}
---------------------------------------------------------------------------------------------------------------
-
-[[CSV-MarshallingaList<Map>toCSV]]
-Marshalling a List<Map> to CSV
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.1*
-
-If you have multiple rows of data you want to be marshalled into CSV
-format you can now store the message payload as a
-`List<Map<String, Object>>` object where the list contains a Map for
-each row.
-
-[[CSV-FilePollerofCSV,thenunmarshaling]]
-File Poller of CSV, then unmarshaling
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Given a bean which can handle the incoming data...
-
-*MyCsvHandler.java*
-
-[source,java]
--------------------------------------------------------
-// Some comments here
-public void doHandleCsvData(List<List<String>> csvData)
-{
-    // do magic here
-}
--------------------------------------------------------
-
-... your route then looks as follows
-
-[source,xml]
-------------------------------------------------------------------------------------------------
-<route>
-        <!-- poll every 10 seconds -->
-        <from uri="file:///some/path/to/pickup/csvfiles?delete=true&amp;consumer.delay=10000" />
-        <unmarshal><csv /></unmarshal>
-        <to uri="bean:myCsvHandler?method=doHandleCsvData" />
-</route>
-------------------------------------------------------------------------------------------------
-
-[[CSV-Marshalingwithapipeasdelimiter]]
-Marshaling with a pipe as delimiter
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Considering the following body
-
-[source,java]
--------------------------------------------------------
-Map<String, Object> body = new LinkedHashMap<>();
-body.put("foo", "abc");
-body.put("bar", 123);
-------------------------------------------------------- 
-
-and this Java route definition 
-
-[source,java]
--------------------------------------------------------
-// Camel version < 2.15
-CsvDataFormat oldCSV = new CsvDataFormat();
-oldCSV.setDelimiter("|");
-from("direct:start")
-    .marshal(oldCSV)
-    .to("mock:result")
- 
-// Camel version >= 2.15
-from("direct:start")
-    .marshal(new CsvDataFormat().setDelimiter(&#39;|&#39;))
-    .to("mock:result")
-------------------------------------------------------- 
-
-or this XML route definition 
-
-[source,xml]
--------------------------------------------------------
-<route>
-  <from uri="direct:start" />
-  <marshal>
-    <csv delimiter="|" />
-  </marshal>
-  <to uri="mock:result" />
-</route>
-------------------------------------------------------- 
-
-then it will produce 
-
-[source,java]
--------------------------------------------------------
-abc|123
-------------------------------------------------------- 
-
-[[CSV-UsingautogenColumns,configRefandstrategyRefattributesinsideXMLDSL]]
-Using autogenColumns, configRef and strategyRef attributes inside XML
-DSL
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.9.2 / 2.10 and deleted for Camel 2.15*
-
-You can customize the CSV link:data-format.html[Data Format] to make use
-of your own `CSVConfig` and/or `CSVStrategy`. Also note that the default
-value of the `autogenColumns` option is true. The following example
-should illustrate this customization.
-
-[source,xml]
------------------------------------------------------------------------------------------------------------------------------
-<route>
-  <from uri="direct:start" />
-  <marshal>
-    <!-- make use of a strategy other than the default one which is 'org.apache.commons.csv.CSVStrategy.DEFAULT_STRATEGY' -->
-    <csv autogenColumns="false" delimiter="|" configRef="csvConfig" strategyRef="excelStrategy" />
-  </marshal>
-  <convertBodyTo type="java.lang.String" />
-  <to uri="mock:result" />
-</route>
-
-<bean id="csvConfig" class="org.apache.commons.csv.writer.CSVConfig">
-  <property name="fields">
-    <list>
-      <bean class="org.apache.commons.csv.writer.CSVField">
-        <property name="name" value="orderId" />
-      </bean>
-      <bean class="org.apache.commons.csv.writer.CSVField">
-        <property name="name" value="amount" />
-      </bean>
-    </list>
-  </property>
-</bean>
-
-<bean id="excelStrategy" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean">
-  <property name="staticField" value="org.apache.commons.csv.CSVStrategy.EXCEL_STRATEGY" />
-</bean>
------------------------------------------------------------------------------------------------------------------------------
-
-[[CSV-UsingskipFirstLineoptionwhileunmarshaling]]
-Using skipFirstLine option while unmarshaling
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-*Available as of Camel 2.10 and deleted for Camel 2.15*
-
-You can instruct the CSV link:data-format.html[Data Format] to skip the
-first line which contains the CSV headers. Using the Spring/XML DSL:
-
-[source,xml]
----------------------------------------------------
-<route>
-  <from uri="direct:start" />
-  <unmarshal>
-    <csv skipFirstLine="true" />
-  </unmarshal>
-  <to uri="bean:myCsvHandler?method=doHandleCsv" />
-</route>
----------------------------------------------------
-
-Or the Java DSL:
-
-[source,java]
---------------------------------------------
-CsvDataFormat csv = new CsvDataFormat();
-csv.setSkipFirstLine(true);
-
-from("direct:start")
-  .unmarshal(csv)
-.to("bean:myCsvHandler?method=doHandleCsv");
---------------------------------------------
-
-[[CSV-Unmarshalingwithapipeasdelimiter]]
-Unmarshaling with a pipe as delimiter
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Using the Spring/XML DSL:
-
-[source,xml]
----------------------------------------------------
-<route>
-  <from uri="direct:start" />
-  <unmarshal>
-    <csv delimiter="|" />
-  </unmarshal>
-  <to uri="bean:myCsvHandler?method=doHandleCsv" />
-</route>
----------------------------------------------------
-
-Or the Java DSL:
-
-[source,java]
-----------------------------------------------------
-CsvDataFormat csv = new CsvDataFormat();
-CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
-strategy.setDelimiter('|');
-csv.setStrategy(strategy);
-
-from("direct:start")
-  .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-----------------------------------------------------
-
-[source,java]
-----------------------------------------------
-CsvDataFormat csv = new CsvDataFormat();
-csv.setDelimiter("|");
-
-from("direct:start")
-  .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-----------------------------------------------
-
-[source,java]
-----------------------------------------------
-CsvDataFormat csv = new CsvDataFormat();
-CSVConfig csvConfig = new CSVConfig();
-csvConfig.setDelimiter(";");
-csv.setConfig(csvConfig);
-
-from("direct:start")
-  .unmarshal(csv)
-  .to("bean:myCsvHandler?method=doHandleCsv");
-----------------------------------------------
-
-*Issue in CSVConfig*
-
-It looks like that
-
-[source,java]
---------------------------------------
-CSVConfig csvConfig = new CSVConfig();
-csvConfig.setDelimiter(';');
---------------------------------------
-
-doesn't work. You have to set the delimiter as a String!
-
-[[CSV-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use CSV in your Camel routes you need to add a dependency on
-*camel-csv*, which implements this data format.
-
-If you use Maven you can just add the following to your pom.xml,
-substituting the version number for the latest and greatest release (see
-link:download.html[the download page for the latest versions]).
-
-[source,java]
--------------------------------------
-<dependency>
-  <groupId>org.apache.camel</groupId>
-  <artifactId>camel-csv</artifactId>
-  <version>x.x.x</version>
-</dependency>
--------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-cxf/src/main/docs/cxf-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/docs/cxf-component.adoc b/components/camel-cxf/src/main/docs/cxf-component.adoc
index ba16233..0736ddb 100644
--- a/components/camel-cxf/src/main/docs/cxf-component.adoc
+++ b/components/camel-cxf/src/main/docs/cxf-component.adoc
@@ -122,13 +122,14 @@ Options
 ^^^^^^^
 
 
+
 // component options: START
 The CXF component supports 2 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | allowStreaming | Boolean | This option controls whether the CXF component when running in PAYLOAD mode will DOM parse the incoming messages into DOM Elements or keep the payload as a javax.xml.transform.Source object that would allow streaming in some cases.
@@ -140,6 +141,7 @@ The CXF component supports 2 options which are listed below.
 
 
 
+
 // endpoint options: START
 The CXF component supports 35 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-cxf/src/main/docs/cxfrs-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/docs/cxfrs-component.adoc b/components/camel-cxf/src/main/docs/cxfrs-component.adoc
index 06fa687..2493a2b 100644
--- a/components/camel-cxf/src/main/docs/cxfrs-component.adoc
+++ b/components/camel-cxf/src/main/docs/cxfrs-component.adoc
@@ -62,13 +62,14 @@ Options
 ^^^^^^^
 
 
+
 // component options: START
 The CXF-RS component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | headerFilterStrategy | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message.
@@ -78,6 +79,7 @@ The CXF-RS component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The CXF-RS component supports 29 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-disruptor/src/main/docs/disruptor-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-disruptor/src/main/docs/disruptor-component.adoc b/components/camel-disruptor/src/main/docs/disruptor-component.adoc
index c6d0da4..6068657 100644
--- a/components/camel-disruptor/src/main/docs/disruptor-component.adoc
+++ b/components/camel-disruptor/src/main/docs/disruptor-component.adoc
@@ -98,13 +98,14 @@ All the following options are valid for both the **disruptor:** and
 **disruptor-vm:** components.
 
 
+
 // component options: START
 The Disruptor component supports 7 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | defaultConcurrentConsumers | int | To configure the default number of concurrent consumers
@@ -120,6 +121,7 @@ The Disruptor component supports 7 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Disruptor component supports 13 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-ejb/src/main/docs/ejb-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ejb/src/main/docs/ejb-component.adoc b/components/camel-ejb/src/main/docs/ejb-component.adoc
index 4339603..47261dc 100644
--- a/components/camel-ejb/src/main/docs/ejb-component.adoc
+++ b/components/camel-ejb/src/main/docs/ejb-component.adoc
@@ -36,13 +36,14 @@ Options
 ^^^^^^^
 
 
+
 // component options: START
 The EJB component supports 2 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | context | Context | The Context to use for looking up the EJBs
@@ -53,6 +54,7 @@ The EJB component supports 2 options which are listed below.
 
 
 
+
 // endpoint options: START
 The EJB component supports 7 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc
index 31c3681..ea3234d 100644
--- a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc
+++ b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc
@@ -45,13 +45,14 @@ Endpoint Options
 ^^^^^^^^^^^^^^^^
 
 
+
 // component options: START
 The Elasticsearch component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | client | Client | To use an existing configured Elasticsearch client instead of creating a client per endpoint.
@@ -62,6 +63,7 @@ The Elasticsearch component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Elasticsearch component supports 13 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-facebook/src/main/docs/facebook-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-facebook/src/main/docs/facebook-component.adoc b/components/camel-facebook/src/main/docs/facebook-component.adoc
index 8f58063..df71580 100644
--- a/components/camel-facebook/src/main/docs/facebook-component.adoc
+++ b/components/camel-facebook/src/main/docs/facebook-component.adoc
@@ -56,13 +56,14 @@ to application APIs.
 
 
 
+
 // component options: START
 The Facebook component supports 28 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | FacebookConfiguration | To use the shared configuration. Properties of the shared configuration can also be set individually.
@@ -100,6 +101,7 @@ The Facebook component supports 28 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Facebook component supports 103 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-flink/src/main/docs/flink-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-flink/src/main/docs/flink-component.adoc b/components/camel-flink/src/main/docs/flink-component.adoc
index c40f126..56659b2 100644
--- a/components/camel-flink/src/main/docs/flink-component.adoc
+++ b/components/camel-flink/src/main/docs/flink-component.adoc
@@ -69,13 +69,14 @@ FlinkComponent Options
 
 
 
+
 // component options: START
 The Apache Flink component supports 4 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | dataSet | DataSet | DataSet to compute against.
@@ -89,6 +90,7 @@ The Apache Flink component supports 4 options which are listed below.
 
 
 
+
 Flink DataSet Callback
 ^^^^^^^^^^^^^^^^^^^^^^
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-freemarker/src/main/docs/freemarker-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-freemarker/src/main/docs/freemarker-component.adoc b/components/camel-freemarker/src/main/docs/freemarker-component.adoc
index 7e54a523..896c0b6 100644
--- a/components/camel-freemarker/src/main/docs/freemarker-component.adoc
+++ b/components/camel-freemarker/src/main/docs/freemarker-component.adoc
@@ -41,13 +41,14 @@ Options
 
 
 
+
 // component options: START
 The Freemarker component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | Configuration | To use an existing freemarker.template.Configuration instance as the configuration.
@@ -58,6 +59,7 @@ The Freemarker component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Freemarker component supports 7 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-ganglia/src/main/docs/ganglia-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ganglia/src/main/docs/ganglia-component.adoc b/components/camel-ganglia/src/main/docs/ganglia-component.adoc
index 3c5e6e7..bd057a2 100644
--- a/components/camel-ganglia/src/main/docs/ganglia-component.adoc
+++ b/components/camel-ganglia/src/main/docs/ganglia-component.adoc
@@ -56,13 +56,14 @@ Ganglia component and endpoint URI options
 
 
 
+
 // component options: START
 The Ganglia component supports 15 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | GangliaConfiguration | To use the shared configuration. Properties of the shared configuration can also be set individually.
@@ -88,6 +89,7 @@ The Ganglia component supports 15 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Ganglia component supports 16 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-google-calendar/src/main/docs/google-calendar-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-google-calendar/src/main/docs/google-calendar-component.adoc b/components/camel-google-calendar/src/main/docs/google-calendar-component.adoc
index 88b87a2..fbf7409 100644
--- a/components/camel-google-calendar/src/main/docs/google-calendar-component.adoc
+++ b/components/camel-google-calendar/src/main/docs/google-calendar-component.adoc
@@ -41,13 +41,14 @@ for this component:
 
 
 
+
 // component options: START
 The Google Calendar component supports 13 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | GoogleCalendarConfiguration | To use the shared configuration. Properties of the shared configuration can also be set individually.
@@ -73,6 +74,7 @@ The Google Calendar component supports 13 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Google Calendar component supports 16 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-google-drive/src/main/docs/google-drive-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/docs/google-drive-component.adoc b/components/camel-google-drive/src/main/docs/google-drive-component.adoc
index faea67a..7a6feeb 100644
--- a/components/camel-google-drive/src/main/docs/google-drive-component.adoc
+++ b/components/camel-google-drive/src/main/docs/google-drive-component.adoc
@@ -66,13 +66,14 @@ GoogleDriveComponent
 
 
 
+
 // component options: START
 The Google Drive component supports 10 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | GoogleDriveConfiguration | To use the shared configuration. Properties of the shared configuration can also be set individually.
@@ -95,6 +96,7 @@ The Google Drive component supports 10 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Google Drive component supports 14 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-google-mail/src/main/docs/google-mail-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-google-mail/src/main/docs/google-mail-component.adoc b/components/camel-google-mail/src/main/docs/google-mail-component.adoc
index dcf6af5..d8f98cb 100644
--- a/components/camel-google-mail/src/main/docs/google-mail-component.adoc
+++ b/components/camel-google-mail/src/main/docs/google-mail-component.adoc
@@ -63,13 +63,14 @@ GoogleMailComponent
 
 
 
+
 // component options: START
 The Google Mail component supports 10 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | GoogleMailConfiguration | To use the shared configuration. Properties of the shared configuration can also be set individually.
@@ -91,6 +92,7 @@ The Google Mail component supports 10 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Google Mail component supports 13 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-guava-eventbus/src/main/docs/guava-eventbus-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-guava-eventbus/src/main/docs/guava-eventbus-component.adoc b/components/camel-guava-eventbus/src/main/docs/guava-eventbus-component.adoc
index dd943fe..037a0c8 100644
--- a/components/camel-guava-eventbus/src/main/docs/guava-eventbus-component.adoc
+++ b/components/camel-guava-eventbus/src/main/docs/guava-eventbus-component.adoc
@@ -49,13 +49,14 @@ Options
 
 
 
+
 // component options: START
 The Guava EventBus component supports 2 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | eventBus | EventBus | To use the given Guava EventBus instance
@@ -67,6 +68,7 @@ The Guava EventBus component supports 2 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Guava EventBus component supports 7 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
index f14620d..965b46b 100644
--- a/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
+++ b/components/camel-hazelcast/src/main/docs/hazelcast-component.adoc
@@ -50,13 +50,14 @@ Options
 
 
 
+
 // component options: START
 The Hazelcast component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | hazelcastInstance | HazelcastInstance | The hazelcast instance reference which can be used for hazelcast endpoint. If you don't specify the instance reference camel use the default hazelcast instance from the camel-hazelcast instance.
@@ -68,6 +69,7 @@ The Hazelcast component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The Hazelcast component supports 13 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hbase/src/main/docs/hbase-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hbase/src/main/docs/hbase-component.adoc b/components/camel-hbase/src/main/docs/hbase-component.adoc
index 7dd398c..68eba60 100644
--- a/components/camel-hbase/src/main/docs/hbase-component.adoc
+++ b/components/camel-hbase/src/main/docs/hbase-component.adoc
@@ -111,13 +111,14 @@ Supported URI options
 
 
 
+
 // component options: START
 The HBase component supports 2 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | configuration | Configuration | To use the shared configuration
@@ -130,6 +131,7 @@ The HBase component supports 2 options which are listed below.
 
 
 
+
 // endpoint options: START
 The HBase component supports 17 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hdfs/src/main/docs/hdfs-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hdfs/src/main/docs/hdfs-component.adoc b/components/camel-hdfs/src/main/docs/hdfs-component.adoc
index 41821a2..9a25c52 100644
--- a/components/camel-hdfs/src/main/docs/hdfs-component.adoc
+++ b/components/camel-hdfs/src/main/docs/hdfs-component.adoc
@@ -59,13 +59,14 @@ Options
 
 
 
+
 // component options: START
 The HDFS component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | jAASConfiguration | Configuration | To use the given configuration for security with JAAS.
@@ -78,6 +79,7 @@ The HDFS component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The HDFS component supports 41 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hdfs2/src/main/docs/hdfs2-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hdfs2/src/main/docs/hdfs2-component.adoc b/components/camel-hdfs2/src/main/docs/hdfs2-component.adoc
index 5d0ee27..d283911 100644
--- a/components/camel-hdfs2/src/main/docs/hdfs2-component.adoc
+++ b/components/camel-hdfs2/src/main/docs/hdfs2-component.adoc
@@ -57,13 +57,14 @@ Options
 
 
 
+
 // component options: START
 The HDFS2 component supports 1 options which are listed below.
 
 
 
 {% raw %}
-[width="100%",cols="2s,1m,8",options="header"]
+[width="100%",cols="2s,1m,7",options="header"]
 |=======================================================================
 | Name | Java Type | Description
 | jAASConfiguration | Configuration | To use the given configuration for security with JAAS.
@@ -75,6 +76,7 @@ The HDFS2 component supports 1 options which are listed below.
 
 
 
+
 // endpoint options: START
 The HDFS2 component supports 41 endpoint options which are listed below:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hessian/src/main/docs/hessian-dataformat.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hessian/src/main/docs/hessian-dataformat.adoc b/components/camel-hessian/src/main/docs/hessian-dataformat.adoc
new file mode 100644
index 0000000..72997b7
--- /dev/null
+++ b/components/camel-hessian/src/main/docs/hessian-dataformat.adoc
@@ -0,0 +1,42 @@
+[[hessian-HessianDataFormat]]
+Hessian DataFormat
+~~~~~~~~~~~~~~~~~~
+
+Hessian is Data Format for marshalling and unmarshalling messages using Caucho's Hessian format.
+
+If you want to use Hessian Data Format from Maven, add the following dependency to your `pom.xml`:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-hessian</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+
+[[hessian-UsingHessianDataFormat]]
+Using the Hessian data format in Java DSL
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[source,java]
+--------------------------------------------------------------------------------
+    from("direct:in")
+        .marshal().hessian();
+--------------------------------------------------------------------------------
+
+[[hessian-UsingHessianDataFormatXml]]
+Using the Hessian data format in Spring DSL
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[source,xml]
+--------------------------------------------------------------------------------
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct:in"/>
+            <marshal ref="hessian"/>
+        </route>
+    </camelContext>
+--------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hessian/src/main/docs/hessian.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hessian/src/main/docs/hessian.adoc b/components/camel-hessian/src/main/docs/hessian.adoc
deleted file mode 100644
index 72997b7..0000000
--- a/components/camel-hessian/src/main/docs/hessian.adoc
+++ /dev/null
@@ -1,42 +0,0 @@
-[[hessian-HessianDataFormat]]
-Hessian DataFormat
-~~~~~~~~~~~~~~~~~~
-
-Hessian is Data Format for marshalling and unmarshalling messages using Caucho's Hessian format.
-
-If you want to use Hessian Data Format from Maven, add the following dependency to your `pom.xml`:
-
-[source,xml]
-------------------------------------------------------------
-<dependency>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>camel-hessian</artifactId>
-    <version>x.x.x</version>
-    <!-- use the same version as your Camel core version -->
-</dependency>
-------------------------------------------------------------
-
-
-[[hessian-UsingHessianDataFormat]]
-Using the Hessian data format in Java DSL
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source,java]
---------------------------------------------------------------------------------
-    from("direct:in")
-        .marshal().hessian();
---------------------------------------------------------------------------------
-
-[[hessian-UsingHessianDataFormatXml]]
-Using the Hessian data format in Spring DSL
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source,xml]
---------------------------------------------------------------------------------
-    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-        <route>
-            <from uri="direct:in"/>
-            <marshal ref="hessian"/>
-        </route>
-    </camelContext>
---------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
new file mode 100644
index 0000000..43f12b8
--- /dev/null
+++ b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
@@ -0,0 +1,582 @@
+[[HL7-HL7Component]]
+HL7 Component
+~~~~~~~~~~~~~
+
+The *HL7* component is used for working with the HL7 MLLP protocol and
+http://www.hl7.org/implement/standards/product_brief.cfm?product_id=185[HL7
+v2 messages] using the http://hl7api.sourceforge.net[HAPI library].
+
+This component supports the following:
+
+* HL7 MLLP codec for link:mina2.html[Mina]
+* HL7 MLLP codec for link:netty4.html[Netty4] from *Camel 2.15* onwards
+* link:type-converter.html[Type Converter] from/to HAPI and String
+* HL7 DataFormat using the HAPI library
+* Even more ease-of-use as it's integrated well with the
+link:mina2.html[camel-mina2] component.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-hl7</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[HL7-HL7MLLPprotocol]]
+HL7 MLLP protocol
+^^^^^^^^^^^^^^^^^
+
+HL7 is often used with the HL7 MLLP protocol, which is a text based TCP
+socket based protocol. This component ships with a Mina and Netty4 Codec
+that conforms to the MLLP protocol so you can easily expose an HL7
+listener accepting HL7 requests over the TCP transport layer. To expose
+a HL7 listener service, the link:mina2.html[camel-mina2] or
+link:netty4.html[camel-netty4] component is used with the
+`HL7MLLPCodec` (mina2) or `HL7MLLPNettyDecoder/HL7MLLPNettyEncoder`
+(Netty4).
+
+HL7 MLLP codec can be configured as follows:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Default Value |Description
+
+|`startByte` |`0x0b` |The start byte spanning the HL7 payload.
+
+|`endByte1` |`0x1c` |The first end byte spanning the HL7 payload.
+
+|`endByte2` |`0x0d` |The 2nd end byte spanning the HL7 payload.
+
+|`charset` |JVM Default |The encoding (a
+http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html[charset
+name]) to use for the codec. If not provided, Camel will use the
+http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html#defaultCharset()[JVM
+default Charset].
+
+|`produceString` |`true` |*(as of Camel 2.14.1)* If true, the codec creates a string using the
+defined charset. If false, the codec sends a plain byte array into the
+route, so that the HL7 Data Format can determine the actual charset from
+the HL7 message content.
+
+|`convertLFtoCR` |`false` |Will convert `\n` to `\r` (`0x0d`, 13 decimal) as HL7 stipulates `\r` as
+segment terminators. The HAPI library requires the use of `\r`.
+|=======================================================================
+
+[[HL7-ExposinganHL7listenerusingMina]]
+Exposing an HL7 listener using Mina
++++++++++++++++++++++++++++++++++++
+
+In the Spring XML file, we configure a mina2 endpoint to listen for HL7
+requests using TCP on port `8888`:
+
+[source,xml]
+---------------------------------------------------------------------------------------------------
+    <endpoint id="hl7MinaListener" uri="mina2:tcp://localhost:8888?sync=true&amp;codec=#hl7codec"/>
+---------------------------------------------------------------------------------------------------
+
+*sync=true* indicates that this listener is synchronous and therefore
+will return a HL7 response to the caller. The HL7 codec is setup with
+*codec=#hl7codec*. Note that `hl7codec` is just a Spring bean ID, so it
+could be named `mygreatcodecforhl7` or whatever. The codec is also set
+up in the Spring XML file:
+
+[source,xml]
+----------------------------------------------------------------------------
+    <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
+        <property name="charset" value="iso-8859-1"/>
+    </bean>
+----------------------------------------------------------------------------
+
+The endpoint *hl7MinaLlistener* can then be used in a route as a
+consumer, as this Java DSL example illustrates:
+
+[source,java]
+------------------------------------------------------------
+    from("hl7MinaListener").beanRef("patientLookupService");
+------------------------------------------------------------
+
+This is a very simple route that will listen for HL7 and route it to a
+service named *patientLookupService*. This is also Spring bean ID,
+configured in the Spring XML as:
+
+[source,xml]
+---------------------------------------------------------------------------------------------------
+    <bean id="patientLookupService" class="com.mycompany.healthcare.service.PatientLookupService"/>
+---------------------------------------------------------------------------------------------------
+
+The business logic can be implemented in POJO classes that do not depend
+on Camel, as shown here:
+
+[source,java]
+----------------------------------------------------------------------------------------------------
+import ca.uhn.hl7v2.HL7Exception;
+import ca.uhn.hl7v2.model.Message;
+import ca.uhn.hl7v2.model.v24.segment.QRD;
+
+public class PatientLookupService {
+    public Message lookupPatient(Message input) throws HL7Exception {
+        QRD qrd = (QRD)input.get("QRD");
+        String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();
+
+        // find patient data based on the patient id and create a HL7 model object with the response
+        Message response = ... create and set response data
+        return response
+    }
+----------------------------------------------------------------------------------------------------
+
+[[HL7-ExposinganHL7listenerusingNetty]]
+Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+In the Spring XML file, we configure a netty4 endpoint to listen for HL7
+requests using TCP on port `8888`:
+
+[source,xml]
+---------------------------------------------------------------------------------------------------------------------------------
+    <endpoint id="hl7NettyListener" uri="netty4:tcp://localhost:8888?sync=true&amp;encoder=#hl7encoder&amp;decoder=#hl7decoder"/>
+---------------------------------------------------------------------------------------------------------------------------------
+
+*sync=true* indicates that this listener is synchronous and therefore
+will return a HL7 response to the caller. The HL7 codec is setup with
+*encoder=#hl7encoder*and*decoder=#hl7decoder*. Note that `hl7encoder`
+and `hl7decoder` are just bean IDs, so they could be named differently.
+The beans can be set in the Spring XML file:
+
+[source,xml]
+---------------------------------------------------------------------------------------------
+    <bean id="hl7decoder" class="org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory"/>
+    <bean id="hl7encoder" class="org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory"/>
+---------------------------------------------------------------------------------------------
+
+The endpoint *hl7NettyListener* can then be used in a route as a
+consumer, as this Java DSL example illustrates:
+
+[source,java]
+-------------------------------------------------------------
+    from("hl7NettyListener").beanRef("patientLookupService");
+-------------------------------------------------------------
+
+[[HL7-HL7Modelusingjava.lang.Stringorbyte]]
+HL7 Model using java.lang.String or byte[]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The HL7 MLLP codec uses plain String as its data format. Camel uses its
+link:type-converter.html[Type Converter] to convert to/from strings to
+the HAPI HL7 model objects, but you can use the plain String objects if
+you prefer, for instance if you wish to parse the data yourself.
+
+As of Camel 2.14.1 you can also let both the Mina and Netty codecs use a
+plain `byte[]` as its data format by setting the `produceString`
+property to false. The Type Converter is also capable of converting
+the `byte[]` to/from HAPI HL7 model objects.
+
+[[HL7-HL7v2ModelusingHAPI]]
+HL7v2 Model using HAPI
+^^^^^^^^^^^^^^^^^^^^^^
+
+The HL7v2 model uses Java objects from the HAPI library. Using this
+library, you can encode and decode from the EDI format (ER7) that is
+mostly used with HL7v2.
+
+The sample below is a request to lookup a patient with the patient ID
+`0101701234`.
+
+[source,java]
+-----------------------------------------------------------------------------
+MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4
+QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||
+-----------------------------------------------------------------------------
+
+Using the HL7 model you can work with a `ca.uhn.hl7v2.model.Message`
+object, e.g. to retrieve a patient ID:
+
+[source,java]
+--------------------------------------------------------------------------------------
+Message msg = exchange.getIn().getBody(Message.class);
+QRD qrd = (QRD)msg.get("QRD");
+String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();  // 0101701234
+--------------------------------------------------------------------------------------
+
+This is powerful when combined with the HL7 listener, because you don't
+have to work with `byte[]`, `String` or any other simple object formats.
+You can just use the HAPI HL7v2 model objects. If you know the message
+type in advance, you can be more type-safe:
+
+[source,java]
+--------------------------------------------------------------------------------
+QRY_A19 msg = exchange.getIn().getBody(QRY_A19.class);
+String patientId = msg.getQRD().getWhoSubjectFilter(0).getIDNumber().getValue();
+--------------------------------------------------------------------------------
+
+[[HL7-HL7DataFormat]]
+HL7 DataFormat
+^^^^^^^^^^^^^^
+
+The link:hl7.html[HL7] component ships with a HL7 data format that can
+be used to marshal or unmarshal HL7 model objects.
+
+* `marshal` = from Message to byte stream (can be used when responding
+using the HL7 MLLP codec)
+* `unmarshal` = from byte stream to Message (can be used when receiving
+streamed data from the HL7 MLLP
+
+To use the data format, simply instantiate an instance and invoke the
+marshal or unmarshal operation in the route builder:
+
+[source,java]
+-----------------------------------------------------------
+  DataFormat hl7 = new HL7DataFormat();
+  ...
+  from("direct:hl7in").marshal(hl7).to("jms:queue:hl7out");
+-----------------------------------------------------------
+
+In the sample above, the HL7 is marshalled from a HAPI Message object to
+a byte stream and put on a JMS queue. +
+ The next example is the opposite:
+
+[source,java]
+---------------------------------------------------------------------
+  DataFormat hl7 = new HL7DataFormat();
+  ...
+  from("jms:queue:hl7out").unmarshal(hl7).to("patientLookupService");
+---------------------------------------------------------------------
+
+Here we unmarshal the byte stream into a HAPI Message object that is
+passed to our patient lookup service.
+
+*Serializable messages*
+
+As of HAPI 2.0 (used by *Camel 2.11*), the HL7v2 model classes are fully
+serializable. So you can put HL7v2 messages directly into a JMS queue
+(i.e. without calling `marshal()` and read them again directly from the
+queue (i.e. without calling `unmarshal()`.
+
+*Segment separators*
+
+As of *Camel 2.11*, `unmarshal` does not automatically fix segment
+separators anymore by converting `\n` to `\r`. If you  +
+ need this conversion,
+`org.apache.camel.component.hl7.HL7#convertLFToCR` provides a handy
+`Expression` for this purpose.
+
+
+*Charset*
+
+As of *Camel 2.14.1*, both `marshal and unmarshal` evaluate the charset
+provided in the field `MSH-18`. If this field is empty, by default the
+charset contained in the corresponding Camel charset property/header is
+assumed. You can even change this default behavior by overriding the
+`guessCharsetName` method when inheriting from the `HL7DataFormat`
+class.
+
+ 
+
+There is a shorthand syntax in Camel for well-known data formats that
+are commonly used. Then you don't need to create an instance of the `HL7DataFormat`
+object:
+
+[source,java]
+------------------------------------------------------------------------
+  from("direct:hl7in").marshal().hl7().to("jms:queue:hl7out");
+  from("jms:queue:hl7out").unmarshal().hl7().to("patientLookupService");
+------------------------------------------------------------------------
+
+[[HL7-MessageHeaders]]
+Message Headers
+^^^^^^^^^^^^^^^
+
+The unmarshal operation adds these fields from the MSH segment as
+headers on the Camel message:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Key |MSH field |Example
+
+|`CamelHL7SendingApplication` |`MSH-3` |`MYSERVER`
+
+|`CamelHL7SendingFacility` |`MSH-4` |`MYSERVERAPP`
+
+|`CamelHL7ReceivingApplication` |`MSH-5` |`MYCLIENT`
+
+|`CamelHL7ReceivingFacility` |`MSH-6` |`MYCLIENTAPP`
+
+|`CamelHL7Timestamp` |`MSH-7` |`20071231235900`
+
+|`CamelHL7Security` |`MSH-8` |`null`
+
+|`CamelHL7MessageType` |`MSH-9-1` |`ADT`
+
+|`CamelHL7TriggerEvent` |`MSH-9-2` |`A01`
+
+|`CamelHL7MessageControl` |`MSH-10` |`1234`
+
+|`CamelHL7ProcessingId` |`MSH-11` |`P`
+
+|`CamelHL7VersionId` |`MSH-12` |`2.4`
+
+|`CamelHL7Context |`` |` *(Camel 2.14)* contains the
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/HapiContext.html[HapiContext]
+that was used to parse the message
+
+|`CamelHL7Charset` |`MSH-18` |*(Camel 2.14.1)* `UNICODE UTF-8`
+|=======================================================================
+
+All headers except `CamelHL7Context `are `String` types. If a header
+value is missing, its value is `null`.
+
+[[HL7-Options]]
+Options
+^^^^^^^
+
+The HL7 Data Format supports the following options:
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Option |Default |Description
+
+|`validate` |true |Whether the HAPI Parser should validate the message using the default
+validation rules. It is recommended to use the `parser` or `hapiContext`
+option and initialize it with the desired HAPI
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[`ValidationContext`]
+
+|`parser` |`ca.uhn.hl7v2.parser.GenericParser` |Custom parser to be used. Must be of type
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/Parser.html[`ca.uhn.hl7v2.parser.Parser`].
+Note that
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/GenericParser.html[`GenericParser`]
+also allows to parse XML-encoded HL7v2 messages
+
+|`hapiContext` |`ca.uhn.hl7v2.DefaultHapiContext` |*Camel 2.14:* Custom HAPI context that can define a custom parser,
+custom ValidationContext etc. This gives you full control over the HL7
+parsing and rendering process.
+|=======================================================================
+
+[[HL7-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use HL7 in your Camel routes you'll need to add a dependency on
+*camel-hl7* listed above, which implements this data format.
+
+The HAPI library is split into a
+http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base[base library] and
+several structure libraries, one for each HL7v2 message version:
+
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v21[v2.1
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v22[v2.2
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v23[v2.3
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v231[v2.3.1
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v24[v2.4
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v25[v2.5
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v251[v2.5.1
+structures library]
+* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v26[v2.6
+structures library]
+
+By default `camel-hl7` only references the HAPI
+http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base[base library].
+Applications are responsible for including structure libraries
+themselves. For example, if an application works with HL7v2 message
+versions 2.4 and 2.5 then the following dependencies must be added:
+
+[source,xml]
+-----------------------------------------------------------
+<dependency>
+    <groupId>ca.uhn.hapi</groupId>
+    <artifactId>hapi-structures-v24</artifactId>
+    <version>2.2</version>
+    <!-- use the same version as your hapi-base version -->
+</dependency>
+<dependency>
+    <groupId>ca.uhn.hapi</groupId>
+    <artifactId>hapi-structures-v25</artifactId>
+    <version>2.2</version>
+    <!-- use the same version as your hapi-base version -->
+</dependency>
+-----------------------------------------------------------
+
+Alternatively, an OSGi bundle containing the base library, all
+structures libraries and required dependencies (on the bundle classpath)
+can be downloaded from the
+http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-osgi-base[central Maven
+repository].
+
+[source,xml]
+-------------------------------------------
+<dependency>
+    <groupId>ca.uhn.hapi</groupId>
+    <artifactId>hapi-osgi-base</artifactId>
+    <version>2.2</version>
+</dependency>
+-------------------------------------------
+
+[[HL7-Terserlanguage]]
+Terser language
+^^^^^^^^^^^^^^^
+
+http://hl7api.sourceforge.net[HAPI] provides a
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/util/Terser.html[Terser]
+class that provides access to fields using a commonly used terse
+location specification syntax. The Terser language allows to use this
+syntax to extract values from messages and to use them as expressions
+and predicates for filtering, content-based routing etc.
+
+Sample:
+
+[source,java]
+--------------------------------------------------------------------------------------------------
+import static org.apache.camel.component.hl7.HL7.terser;
+...
+
+   // extract patient ID from field QRD-8 in the QRY_A19 message above and put into message header
+   from("direct:test1")
+      .setHeader("PATIENT_ID",terser("QRD-8(0)-1"))
+      .to("mock:test1");
+
+   // continue processing if extracted field equals a message header
+   from("direct:test2")
+      .filter(terser("QRD-8(0)-1").isEqualTo(header("PATIENT_ID"))
+      .to("mock:test2");
+--------------------------------------------------------------------------------------------------
+
+[[HL7-HL7Validationpredicate]]
+HL7 Validation predicate
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Often it is preferable to first parse a HL7v2 message and in a separate
+step validate it against a HAPI
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[ValidationContext].
+
+Sample:
+
+[source,java]
+----------------------------------------------------------------------
+import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+import ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+   // Use standard or define your own validation rules
+   ValidationContext defaultContext = new DefaultValidation(); 
+
+   // Throws PredicateValidationException if message does not validate
+   from("direct:test1")
+      .validate(messageConformsTo(defaultContext))
+      .to("mock:test1");
+----------------------------------------------------------------------
+
+[[HL7-HL7ValidationpredicateusingtheHapiContext]]
+HL7 Validation predicate using the HapiContext (Camel 2.14)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The HAPI Context is always configured with a
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[ValidationContext]
+(or a
+http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/builder/ValidationRuleBuilder.html[ValidationRuleBuilder]),
+so you can access the validation rules indirectly. Furthermore, when
+unmarshalling the HL7DataFormat forwards the configured HAPI context in
+the `CamelHL7Context` header, and the validation rules of this context
+can be easily reused:
+
+[source,java]
+----------------------------------------------------------------------------------------------------------------
+import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+import static org.apache.camel.component.hl7.HL7.messageConforms
+...
+
+  HapiContext hapiContext = new DefaultHapiContext();
+  hapiContext.getParserConfiguration().setValidating(false); // don't validate during parsing
+  
+  // customize HapiContext some more ... e.g. enforce that PID-8 in ADT_A01 messages of version 2.4 is not empty
+  ValidationRuleBuilder builder = new ValidationRuleBuilder() {
+      @Override
+      protected void configure() {
+         forVersion(Version.V24)
+              .message("ADT", "A01")
+              .terser("PID-8", not(empty()));
+         }
+      };
+  hapiContext.setValidationRuleBuilder(builder);
+
+  HL7DataFormat hl7 = new HL7DataFormat();
+  hl7.setHapiContext(hapiContext);
+
+  from("direct:test1")
+     .unmarshal(hl7)                // uses the GenericParser returned from the HapiContext
+     .validate(messageConforms())   // uses the validation rules returned from the HapiContext
+                                    // equivalent with .validate(messageConformsTo(hapiContext))
+     // route continues from here
+----------------------------------------------------------------------------------------------------------------
+
+ 
+
+[[HL7-HL7Acknowledgementexpression]]
+HL7 Acknowledgement expression
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A common task in HL7v2 processing is to generate an acknowledgement
+message as response to an incoming HL7v2 message, e.g. based on a
+validation result. The `ack` expression lets us accomplish this very
+elegantly:
+
+[source,java]
+------------------------------------------------------------------------------------------
+import static org.apache.camel.component.hl7.HL7.messageConformsTo;
+import static org.apache.camel.component.hl7.HL7.ack;
+import ca.uhn.hl7v2.validation.impl.DefaultValidation;
+...
+
+  // Use standard or define your own validation rules
+   ValidationContext defaultContext = new DefaultValidation(); 
+
+   from("direct:test1")
+      .onException(Exception.class)
+         .handled(true)
+         .transform(ack()) // auto-generates negative ack because of exception in Exchange
+         .end()
+      .validate(messageConformsTo(defaultContext))
+      // do something meaningful here
+      ...
+      // acknowledgement
+      .transform(ack())
+------------------------------------------------------------------------------------------
+
+[[HL7-MoreSamples]]
+More Samples
+^^^^^^^^^^^^
+
+In the following example, a plain `String` HL7 request is sent to an HL7
+listener that sends back a response:
+
+In the next sample, HL7 requests from the HL7 listener are routed to the
+business logic, which is implemented as plain POJO registered in the
+registry as `hl7service`.
+
+Then the Camel routes using the `RouteBuilder` may look as follows:
+
+Note that by using the HL7 DataFormat the Camel message headers are
+populated with the fields from the MSH segment. The headers are
+particularly useful for filtering or content-based routing as shown in
+the example above.
+
+ 
+
+[[HL7-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/96f3710b/components/camel-hl7/src/main/docs/hl7.adoc
----------------------------------------------------------------------
diff --git a/components/camel-hl7/src/main/docs/hl7.adoc b/components/camel-hl7/src/main/docs/hl7.adoc
deleted file mode 100644
index 43f12b8..0000000
--- a/components/camel-hl7/src/main/docs/hl7.adoc
+++ /dev/null
@@ -1,582 +0,0 @@
-[[HL7-HL7Component]]
-HL7 Component
-~~~~~~~~~~~~~
-
-The *HL7* component is used for working with the HL7 MLLP protocol and
-http://www.hl7.org/implement/standards/product_brief.cfm?product_id=185[HL7
-v2 messages] using the http://hl7api.sourceforge.net[HAPI library].
-
-This component supports the following:
-
-* HL7 MLLP codec for link:mina2.html[Mina]
-* HL7 MLLP codec for link:netty4.html[Netty4] from *Camel 2.15* onwards
-* link:type-converter.html[Type Converter] from/to HAPI and String
-* HL7 DataFormat using the HAPI library
-* Even more ease-of-use as it's integrated well with the
-link:mina2.html[camel-mina2] component.
-
-Maven users will need to add the following dependency to their `pom.xml`
-for this component:
-
-[source,xml]
-------------------------------------------------------------
-<dependency>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>camel-hl7</artifactId>
-    <version>x.x.x</version>
-    <!-- use the same version as your Camel core version -->
-</dependency>
-------------------------------------------------------------
-
-[[HL7-HL7MLLPprotocol]]
-HL7 MLLP protocol
-^^^^^^^^^^^^^^^^^
-
-HL7 is often used with the HL7 MLLP protocol, which is a text based TCP
-socket based protocol. This component ships with a Mina and Netty4 Codec
-that conforms to the MLLP protocol so you can easily expose an HL7
-listener accepting HL7 requests over the TCP transport layer. To expose
-a HL7 listener service, the link:mina2.html[camel-mina2] or
-link:netty4.html[camel-netty4] component is used with the
-`HL7MLLPCodec` (mina2) or `HL7MLLPNettyDecoder/HL7MLLPNettyEncoder`
-(Netty4).
-
-HL7 MLLP codec can be configured as follows:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Name |Default Value |Description
-
-|`startByte` |`0x0b` |The start byte spanning the HL7 payload.
-
-|`endByte1` |`0x1c` |The first end byte spanning the HL7 payload.
-
-|`endByte2` |`0x0d` |The 2nd end byte spanning the HL7 payload.
-
-|`charset` |JVM Default |The encoding (a
-http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html[charset
-name]) to use for the codec. If not provided, Camel will use the
-http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html#defaultCharset()[JVM
-default Charset].
-
-|`produceString` |`true` |*(as of Camel 2.14.1)* If true, the codec creates a string using the
-defined charset. If false, the codec sends a plain byte array into the
-route, so that the HL7 Data Format can determine the actual charset from
-the HL7 message content.
-
-|`convertLFtoCR` |`false` |Will convert `\n` to `\r` (`0x0d`, 13 decimal) as HL7 stipulates `\r` as
-segment terminators. The HAPI library requires the use of `\r`.
-|=======================================================================
-
-[[HL7-ExposinganHL7listenerusingMina]]
-Exposing an HL7 listener using Mina
-+++++++++++++++++++++++++++++++++++
-
-In the Spring XML file, we configure a mina2 endpoint to listen for HL7
-requests using TCP on port `8888`:
-
-[source,xml]
----------------------------------------------------------------------------------------------------
-    <endpoint id="hl7MinaListener" uri="mina2:tcp://localhost:8888?sync=true&amp;codec=#hl7codec"/>
----------------------------------------------------------------------------------------------------
-
-*sync=true* indicates that this listener is synchronous and therefore
-will return a HL7 response to the caller. The HL7 codec is setup with
-*codec=#hl7codec*. Note that `hl7codec` is just a Spring bean ID, so it
-could be named `mygreatcodecforhl7` or whatever. The codec is also set
-up in the Spring XML file:
-
-[source,xml]
-----------------------------------------------------------------------------
-    <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
-        <property name="charset" value="iso-8859-1"/>
-    </bean>
-----------------------------------------------------------------------------
-
-The endpoint *hl7MinaLlistener* can then be used in a route as a
-consumer, as this Java DSL example illustrates:
-
-[source,java]
-------------------------------------------------------------
-    from("hl7MinaListener").beanRef("patientLookupService");
-------------------------------------------------------------
-
-This is a very simple route that will listen for HL7 and route it to a
-service named *patientLookupService*. This is also Spring bean ID,
-configured in the Spring XML as:
-
-[source,xml]
----------------------------------------------------------------------------------------------------
-    <bean id="patientLookupService" class="com.mycompany.healthcare.service.PatientLookupService"/>
----------------------------------------------------------------------------------------------------
-
-The business logic can be implemented in POJO classes that do not depend
-on Camel, as shown here:
-
-[source,java]
-----------------------------------------------------------------------------------------------------
-import ca.uhn.hl7v2.HL7Exception;
-import ca.uhn.hl7v2.model.Message;
-import ca.uhn.hl7v2.model.v24.segment.QRD;
-
-public class PatientLookupService {
-    public Message lookupPatient(Message input) throws HL7Exception {
-        QRD qrd = (QRD)input.get("QRD");
-        String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();
-
-        // find patient data based on the patient id and create a HL7 model object with the response
-        Message response = ... create and set response data
-        return response
-    }
-----------------------------------------------------------------------------------------------------
-
-[[HL7-ExposinganHL7listenerusingNetty]]
-Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-In the Spring XML file, we configure a netty4 endpoint to listen for HL7
-requests using TCP on port `8888`:
-
-[source,xml]
----------------------------------------------------------------------------------------------------------------------------------
-    <endpoint id="hl7NettyListener" uri="netty4:tcp://localhost:8888?sync=true&amp;encoder=#hl7encoder&amp;decoder=#hl7decoder"/>
----------------------------------------------------------------------------------------------------------------------------------
-
-*sync=true* indicates that this listener is synchronous and therefore
-will return a HL7 response to the caller. The HL7 codec is setup with
-*encoder=#hl7encoder*and*decoder=#hl7decoder*. Note that `hl7encoder`
-and `hl7decoder` are just bean IDs, so they could be named differently.
-The beans can be set in the Spring XML file:
-
-[source,xml]
----------------------------------------------------------------------------------------------
-    <bean id="hl7decoder" class="org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory"/>
-    <bean id="hl7encoder" class="org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory"/>
----------------------------------------------------------------------------------------------
-
-The endpoint *hl7NettyListener* can then be used in a route as a
-consumer, as this Java DSL example illustrates:
-
-[source,java]
--------------------------------------------------------------
-    from("hl7NettyListener").beanRef("patientLookupService");
--------------------------------------------------------------
-
-[[HL7-HL7Modelusingjava.lang.Stringorbyte]]
-HL7 Model using java.lang.String or byte[]
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The HL7 MLLP codec uses plain String as its data format. Camel uses its
-link:type-converter.html[Type Converter] to convert to/from strings to
-the HAPI HL7 model objects, but you can use the plain String objects if
-you prefer, for instance if you wish to parse the data yourself.
-
-As of Camel 2.14.1 you can also let both the Mina and Netty codecs use a
-plain `byte[]` as its data format by setting the `produceString`
-property to false. The Type Converter is also capable of converting
-the `byte[]` to/from HAPI HL7 model objects.
-
-[[HL7-HL7v2ModelusingHAPI]]
-HL7v2 Model using HAPI
-^^^^^^^^^^^^^^^^^^^^^^
-
-The HL7v2 model uses Java objects from the HAPI library. Using this
-library, you can encode and decode from the EDI format (ER7) that is
-mostly used with HL7v2.
-
-The sample below is a request to lookup a patient with the patient ID
-`0101701234`.
-
-[source,java]
------------------------------------------------------------------------------
-MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4
-QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||
------------------------------------------------------------------------------
-
-Using the HL7 model you can work with a `ca.uhn.hl7v2.model.Message`
-object, e.g. to retrieve a patient ID:
-
-[source,java]
---------------------------------------------------------------------------------------
-Message msg = exchange.getIn().getBody(Message.class);
-QRD qrd = (QRD)msg.get("QRD");
-String patientId = qrd.getWhoSubjectFilter(0).getIDNumber().getValue();  // 0101701234
---------------------------------------------------------------------------------------
-
-This is powerful when combined with the HL7 listener, because you don't
-have to work with `byte[]`, `String` or any other simple object formats.
-You can just use the HAPI HL7v2 model objects. If you know the message
-type in advance, you can be more type-safe:
-
-[source,java]
---------------------------------------------------------------------------------
-QRY_A19 msg = exchange.getIn().getBody(QRY_A19.class);
-String patientId = msg.getQRD().getWhoSubjectFilter(0).getIDNumber().getValue();
---------------------------------------------------------------------------------
-
-[[HL7-HL7DataFormat]]
-HL7 DataFormat
-^^^^^^^^^^^^^^
-
-The link:hl7.html[HL7] component ships with a HL7 data format that can
-be used to marshal or unmarshal HL7 model objects.
-
-* `marshal` = from Message to byte stream (can be used when responding
-using the HL7 MLLP codec)
-* `unmarshal` = from byte stream to Message (can be used when receiving
-streamed data from the HL7 MLLP
-
-To use the data format, simply instantiate an instance and invoke the
-marshal or unmarshal operation in the route builder:
-
-[source,java]
------------------------------------------------------------
-  DataFormat hl7 = new HL7DataFormat();
-  ...
-  from("direct:hl7in").marshal(hl7).to("jms:queue:hl7out");
------------------------------------------------------------
-
-In the sample above, the HL7 is marshalled from a HAPI Message object to
-a byte stream and put on a JMS queue. +
- The next example is the opposite:
-
-[source,java]
----------------------------------------------------------------------
-  DataFormat hl7 = new HL7DataFormat();
-  ...
-  from("jms:queue:hl7out").unmarshal(hl7).to("patientLookupService");
----------------------------------------------------------------------
-
-Here we unmarshal the byte stream into a HAPI Message object that is
-passed to our patient lookup service.
-
-*Serializable messages*
-
-As of HAPI 2.0 (used by *Camel 2.11*), the HL7v2 model classes are fully
-serializable. So you can put HL7v2 messages directly into a JMS queue
-(i.e. without calling `marshal()` and read them again directly from the
-queue (i.e. without calling `unmarshal()`.
-
-*Segment separators*
-
-As of *Camel 2.11*, `unmarshal` does not automatically fix segment
-separators anymore by converting `\n` to `\r`. If you  +
- need this conversion,
-`org.apache.camel.component.hl7.HL7#convertLFToCR` provides a handy
-`Expression` for this purpose.
-
-
-*Charset*
-
-As of *Camel 2.14.1*, both `marshal and unmarshal` evaluate the charset
-provided in the field `MSH-18`. If this field is empty, by default the
-charset contained in the corresponding Camel charset property/header is
-assumed. You can even change this default behavior by overriding the
-`guessCharsetName` method when inheriting from the `HL7DataFormat`
-class.
-
- 
-
-There is a shorthand syntax in Camel for well-known data formats that
-are commonly used. Then you don't need to create an instance of the `HL7DataFormat`
-object:
-
-[source,java]
-------------------------------------------------------------------------
-  from("direct:hl7in").marshal().hl7().to("jms:queue:hl7out");
-  from("jms:queue:hl7out").unmarshal().hl7().to("patientLookupService");
-------------------------------------------------------------------------
-
-[[HL7-MessageHeaders]]
-Message Headers
-^^^^^^^^^^^^^^^
-
-The unmarshal operation adds these fields from the MSH segment as
-headers on the Camel message:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Key |MSH field |Example
-
-|`CamelHL7SendingApplication` |`MSH-3` |`MYSERVER`
-
-|`CamelHL7SendingFacility` |`MSH-4` |`MYSERVERAPP`
-
-|`CamelHL7ReceivingApplication` |`MSH-5` |`MYCLIENT`
-
-|`CamelHL7ReceivingFacility` |`MSH-6` |`MYCLIENTAPP`
-
-|`CamelHL7Timestamp` |`MSH-7` |`20071231235900`
-
-|`CamelHL7Security` |`MSH-8` |`null`
-
-|`CamelHL7MessageType` |`MSH-9-1` |`ADT`
-
-|`CamelHL7TriggerEvent` |`MSH-9-2` |`A01`
-
-|`CamelHL7MessageControl` |`MSH-10` |`1234`
-
-|`CamelHL7ProcessingId` |`MSH-11` |`P`
-
-|`CamelHL7VersionId` |`MSH-12` |`2.4`
-
-|`CamelHL7Context |`` |` *(Camel 2.14)* contains the
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/HapiContext.html[HapiContext]
-that was used to parse the message
-
-|`CamelHL7Charset` |`MSH-18` |*(Camel 2.14.1)* `UNICODE UTF-8`
-|=======================================================================
-
-All headers except `CamelHL7Context `are `String` types. If a header
-value is missing, its value is `null`.
-
-[[HL7-Options]]
-Options
-^^^^^^^
-
-The HL7 Data Format supports the following options:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Option |Default |Description
-
-|`validate` |true |Whether the HAPI Parser should validate the message using the default
-validation rules. It is recommended to use the `parser` or `hapiContext`
-option and initialize it with the desired HAPI
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[`ValidationContext`]
-
-|`parser` |`ca.uhn.hl7v2.parser.GenericParser` |Custom parser to be used. Must be of type
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/Parser.html[`ca.uhn.hl7v2.parser.Parser`].
-Note that
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/parser/GenericParser.html[`GenericParser`]
-also allows to parse XML-encoded HL7v2 messages
-
-|`hapiContext` |`ca.uhn.hl7v2.DefaultHapiContext` |*Camel 2.14:* Custom HAPI context that can define a custom parser,
-custom ValidationContext etc. This gives you full control over the HL7
-parsing and rendering process.
-|=======================================================================
-
-[[HL7-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use HL7 in your Camel routes you'll need to add a dependency on
-*camel-hl7* listed above, which implements this data format.
-
-The HAPI library is split into a
-http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base[base library] and
-several structure libraries, one for each HL7v2 message version:
-
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v21[v2.1
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v22[v2.2
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v23[v2.3
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v231[v2.3.1
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v24[v2.4
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v25[v2.5
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v251[v2.5.1
-structures library]
-* http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-structures-v26[v2.6
-structures library]
-
-By default `camel-hl7` only references the HAPI
-http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-base[base library].
-Applications are responsible for including structure libraries
-themselves. For example, if an application works with HL7v2 message
-versions 2.4 and 2.5 then the following dependencies must be added:
-
-[source,xml]
------------------------------------------------------------
-<dependency>
-    <groupId>ca.uhn.hapi</groupId>
-    <artifactId>hapi-structures-v24</artifactId>
-    <version>2.2</version>
-    <!-- use the same version as your hapi-base version -->
-</dependency>
-<dependency>
-    <groupId>ca.uhn.hapi</groupId>
-    <artifactId>hapi-structures-v25</artifactId>
-    <version>2.2</version>
-    <!-- use the same version as your hapi-base version -->
-</dependency>
------------------------------------------------------------
-
-Alternatively, an OSGi bundle containing the base library, all
-structures libraries and required dependencies (on the bundle classpath)
-can be downloaded from the
-http://repo1.maven.org/maven2/ca/uhn/hapi/hapi-osgi-base[central Maven
-repository].
-
-[source,xml]
--------------------------------------------
-<dependency>
-    <groupId>ca.uhn.hapi</groupId>
-    <artifactId>hapi-osgi-base</artifactId>
-    <version>2.2</version>
-</dependency>
--------------------------------------------
-
-[[HL7-Terserlanguage]]
-Terser language
-^^^^^^^^^^^^^^^
-
-http://hl7api.sourceforge.net[HAPI] provides a
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/util/Terser.html[Terser]
-class that provides access to fields using a commonly used terse
-location specification syntax. The Terser language allows to use this
-syntax to extract values from messages and to use them as expressions
-and predicates for filtering, content-based routing etc.
-
-Sample:
-
-[source,java]
---------------------------------------------------------------------------------------------------
-import static org.apache.camel.component.hl7.HL7.terser;
-...
-
-   // extract patient ID from field QRD-8 in the QRY_A19 message above and put into message header
-   from("direct:test1")
-      .setHeader("PATIENT_ID",terser("QRD-8(0)-1"))
-      .to("mock:test1");
-
-   // continue processing if extracted field equals a message header
-   from("direct:test2")
-      .filter(terser("QRD-8(0)-1").isEqualTo(header("PATIENT_ID"))
-      .to("mock:test2");
---------------------------------------------------------------------------------------------------
-
-[[HL7-HL7Validationpredicate]]
-HL7 Validation predicate
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Often it is preferable to first parse a HL7v2 message and in a separate
-step validate it against a HAPI
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[ValidationContext].
-
-Sample:
-
-[source,java]
-----------------------------------------------------------------------
-import static org.apache.camel.component.hl7.HL7.messageConformsTo;
-import ca.uhn.hl7v2.validation.impl.DefaultValidation;
-...
-
-   // Use standard or define your own validation rules
-   ValidationContext defaultContext = new DefaultValidation(); 
-
-   // Throws PredicateValidationException if message does not validate
-   from("direct:test1")
-      .validate(messageConformsTo(defaultContext))
-      .to("mock:test1");
-----------------------------------------------------------------------
-
-[[HL7-HL7ValidationpredicateusingtheHapiContext]]
-HL7 Validation predicate using the HapiContext (Camel 2.14)
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The HAPI Context is always configured with a
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/ValidationContext.html[ValidationContext]
-(or a
-http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/validation/builder/ValidationRuleBuilder.html[ValidationRuleBuilder]),
-so you can access the validation rules indirectly. Furthermore, when
-unmarshalling the HL7DataFormat forwards the configured HAPI context in
-the `CamelHL7Context` header, and the validation rules of this context
-can be easily reused:
-
-[source,java]
-----------------------------------------------------------------------------------------------------------------
-import static org.apache.camel.component.hl7.HL7.messageConformsTo;
-import static org.apache.camel.component.hl7.HL7.messageConforms
-...
-
-  HapiContext hapiContext = new DefaultHapiContext();
-  hapiContext.getParserConfiguration().setValidating(false); // don't validate during parsing
-  
-  // customize HapiContext some more ... e.g. enforce that PID-8 in ADT_A01 messages of version 2.4 is not empty
-  ValidationRuleBuilder builder = new ValidationRuleBuilder() {
-      @Override
-      protected void configure() {
-         forVersion(Version.V24)
-              .message("ADT", "A01")
-              .terser("PID-8", not(empty()));
-         }
-      };
-  hapiContext.setValidationRuleBuilder(builder);
-
-  HL7DataFormat hl7 = new HL7DataFormat();
-  hl7.setHapiContext(hapiContext);
-
-  from("direct:test1")
-     .unmarshal(hl7)                // uses the GenericParser returned from the HapiContext
-     .validate(messageConforms())   // uses the validation rules returned from the HapiContext
-                                    // equivalent with .validate(messageConformsTo(hapiContext))
-     // route continues from here
-----------------------------------------------------------------------------------------------------------------
-
- 
-
-[[HL7-HL7Acknowledgementexpression]]
-HL7 Acknowledgement expression
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-A common task in HL7v2 processing is to generate an acknowledgement
-message as response to an incoming HL7v2 message, e.g. based on a
-validation result. The `ack` expression lets us accomplish this very
-elegantly:
-
-[source,java]
-------------------------------------------------------------------------------------------
-import static org.apache.camel.component.hl7.HL7.messageConformsTo;
-import static org.apache.camel.component.hl7.HL7.ack;
-import ca.uhn.hl7v2.validation.impl.DefaultValidation;
-...
-
-  // Use standard or define your own validation rules
-   ValidationContext defaultContext = new DefaultValidation(); 
-
-   from("direct:test1")
-      .onException(Exception.class)
-         .handled(true)
-         .transform(ack()) // auto-generates negative ack because of exception in Exchange
-         .end()
-      .validate(messageConformsTo(defaultContext))
-      // do something meaningful here
-      ...
-      // acknowledgement
-      .transform(ack())
-------------------------------------------------------------------------------------------
-
-[[HL7-MoreSamples]]
-More Samples
-^^^^^^^^^^^^
-
-In the following example, a plain `String` HL7 request is sent to an HL7
-listener that sends back a response:
-
-In the next sample, HL7 requests from the HL7 listener are routed to the
-business logic, which is implemented as plain POJO registered in the
-registry as `hl7service`.
-
-Then the Camel routes using the `RouteBuilder` may look as follows:
-
-Note that by using the HL7 DataFormat the Camel message headers are
-populated with the fields from the MSH segment. The headers are
-particularly useful for filtering or content-based routing as shown in
-the example above.
-
- 
-
-[[HL7-SeeAlso]]
-See Also
-^^^^^^^^
-
-* link:configuring-camel.html[Configuring Camel]
-* link:component.html[Component]
-* link:endpoint.html[Endpoint]
-* link:getting-started.html[Getting Started]
-


Mime
View raw message