You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/05/27 07:10:42 UTC

camel git commit: Added camel-snakeyaml docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master 139bb76d3 -> e09d69644


Added camel-snakeyaml docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e09d6964
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e09d6964
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e09d6964

Branch: refs/heads/master
Commit: e09d6964497b6c6e9271dd4cf18863de42215d58
Parents: 139bb76
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri May 27 09:10:01 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri May 27 09:10:01 2016 +0200

----------------------------------------------------------------------
 .../camel-snakeyaml/src/main/docs/yaml.adoc     | 119 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 120 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e09d6964/components/camel-snakeyaml/src/main/docs/yaml.adoc
----------------------------------------------------------------------
diff --git a/components/camel-snakeyaml/src/main/docs/yaml.adoc b/components/camel-snakeyaml/src/main/docs/yaml.adoc
new file mode 100644
index 0000000..cfea419
--- /dev/null
+++ b/components/camel-snakeyaml/src/main/docs/yaml.adoc
@@ -0,0 +1,119 @@
+[[YAMLDataFormat-YAML]]
+YAML
+~~~~
+
+YAML is a�link:data-format.html[Data Format]�to marshal and unmarshal
+Java objects to and from�http://www.yaml.org/[YAML].
+
+For YAML to object marshalling, Camel provides integration with three
+popular YAML libraries:
+
+* The�http://www.snakeyaml.org/[SnakeYAML] library
+
+Every library requires adding the special camel component (see
+"Dependency..." paragraphs further down). By default Camel uses the
+SnakeYAML library.
+
+[[YAMLDataFormat-UsingYAMLdataformatwiththeSnakeYAMLlibrary]]
+Using YAML data format with the SnakeYAML library
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[source,java]
+------------------------------------------------------------
+// lets turn Object messages into yaml then send to MQSeries
+from("activemq:My.Queue")
+  .marshal().yaml()
+  .to("mqseries:Another.Queue");
+------------------------------------------------------------
+
+[source,java]
+------------------------------------------------------------
+// lets turn Object messages into yaml then send to MQSeries
+from("activemq:My.Queue")
+  .marshal().yaml(YAMLLibrary.SnakeYAML)
+  .to("mqseries:Another.Queue");
+------------------------------------------------------------
+
+[[YAMLDataFormat-UsingYAMLinSpringDSL]]
+Using YAML in Spring DSL
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+When using�link:data-format.html[Data Format]�in Spring DSL you need to
+declare the data formats first. This is done in the�*DataFormats*�XML
+tag.
+
+[source,xml]
+----------------------------------------------------------------------------------------------------------------------------------
+        <dataFormats>
+            <!-- here we define a YAML data format with the id snak and that it should use the TestPojo as the class type when
+                 doing unmarshal. The unmarshalTypeName is optional, if not provided Camel will use a Object.class as the type -->
+            <yaml id="snake" library="SnakeYAML" unmarshalTypeName="org.apache.camel.component.yaml.model.TestPojo"/>
+        </dataFormats>
+----------------------------------------------------------------------------------------------------------------------------------
+
+And then you can refer to this id in the route:
+
+[source,xml]
+-------------------------------------
+       <route>
+            <from uri="direct:back"/>
+            <unmarshal ref="snake"/>
+            <to uri="mock:reverse"/>
+        </route>
+-------------------------------------
+
+�
+
+[[YAMLDataFormat-OptionsforSnakeYAMLDataFormat]]
+Options for SnakeYAML Data Format
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[width="100%",cols="<25%,<25%,<25%,<25%",options="header",]
+|=======================================================================
+|Name |Type |Default |Description
+|unmarshalType |`Class` |`Object.class` |Class of the object to be created
+
+|classLoader |ClassLoader |null |The classloader to use to
+instantiate objects
+
+|constructor |String |null |A reference to an 
+org.yaml.snakeyaml.constructor.BaseConstructor instance in the registry
+
+|representer |String |null |A reference to an 
+org.yaml.snakeyaml.representer.Representer instance in the registry
+
+|dumperOptions |String |null |A reference to an 
+org.yaml.snakeyaml.DumperOptions instance in the registry
+
+|resolver |String |null |A reference to an 
+org.yaml.snakeyaml.resolver.Resolver instance in the registry
+
+|useApplicationContextClassLoader |�Boolean |true� |To use CamelContext's ApplicationContextClassLoader if no custom class loader is set and
+ApplicationContextClassLoader is provided
+
+|prettyFlow |�Boolean |false� |Force the emitter to produce a pretty YAML document when using the flow style
+|=======================================================================
+
+[[YAMLDataFormat-DependenciesforSnakeYAML]]
+Dependencies for SnakeYAML
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To use YAML in your camel routes you need to add the a dependency
+on�*camel-snakeyaml*�which implements this data format.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release
+(see�link:download.html[the download page for the latest versions]).
+
+[source,xml]
+------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-snakeyaml</artifactId>
+  <version>${camel-version}</version>
+</dependency>
+------------------------------------------
+
+�
+
+�

http://git-wip-us.apache.org/repos/asf/camel/blob/e09d6964/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 8db34ca..0ed562a 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -267,6 +267,7 @@
     * [Lzf](lzf.adoc)
     * [Protobuf](protobuf.adoc)
     * [XML JSON](xmljson.adoc)
+    * [YAML](yaml.adoc)
 
 * User Guide
     * [Karaf](karaf.adoc)