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/06/07 13:38:55 UTC

[1/2] camel git commit: Added camel-spring-javaconfig docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master 2e504c2ae -> f0b952668


Added camel-spring-javaconfig 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/104532e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/104532e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/104532e7

Branch: refs/heads/master
Commit: 104532e7863b0feb8b2df45fcafc5c59f78c4c15
Parents: 2e504c2
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Jun 7 15:33:48 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Jun 7 15:33:48 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/spring-java-config.adoc       | 98 ++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |  1 +
 2 files changed, 99 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/104532e7/components/camel-spring-javaconfig/src/main/docs/spring-java-config.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-javaconfig/src/main/docs/spring-java-config.adoc b/components/camel-spring-javaconfig/src/main/docs/spring-java-config.adoc
new file mode 100644
index 0000000..42127db
--- /dev/null
+++ b/components/camel-spring-javaconfig/src/main/docs/spring-java-config.adoc
@@ -0,0 +1,98 @@
+[[SpringJavaConfig-SpringJavaConfig]]
+Spring Java Config
+~~~~~~~~~~~~~~~~~~
+
+link:spring.html[Spring] started life using XML Config to wire beans
+together. However some folks don't like using XML and would rather use
+Java code which led to the creation of Guice along with the Spring
+JavaConfig project.
+
+You can use either the XML or Java config approaches with Camel; its
+your choice really on which you prefer.
+
+[[SpringJavaConfig-UsingSpringJavaConfig]]
+Using Spring Java Config
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+To use Spring Java Config in your Camel project the easiest thing to do
+is add the following to your pom.xml
+
+[source,xml]
+--------------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-spring-javaconfig</artifactId>
+  <version>${camel-version}</version>
+</dependency>
+--------------------------------------------------
+
+This will then add the dependencies on the Spring JavaConfig library
+along with some helper classes for configuring Camel inside Spring.
+
+Note that this library is totally optional; you could just wire Camel
+together yourself with Java Config.
+
+[[SpringJavaConfig-Configuration]]
+Configuration
+^^^^^^^^^^^^^
+
+The most common case of using JavaConfig with Camel would be to create
+configuration with defined list of routes to be used by router.
+
+[source,java]
+--------------------------------------------------------------------
+@Configuration
+public class MyRouteConfiguration extends CamelConfiguration {
+
+    @Autowire
+    private MyRouteBuilder myRouteBuilder;
+
+    @Autowire
+    private MyAnotherRouteBuilder myAnotherRouteBuilder;
+
+    @Override
+    public List<RouteBuilder> routes() {
+        return Arrays.asList(myRouteBuilder, myAnotherRouteBuilder);
+    } 
+
+}
+--------------------------------------------------------------------
+
+Starting from Camel 2.13.0 you can skip the *routes()* definition, and
+fall back to the *RouteBuilder* instances located in the Spring context.
+
+[source,java]
+--------------------------------------------------------------
+@Configuration
+@ComponentScan("com.example.routes")
+public class MyRouteConfiguration extends CamelConfiguration {
+}
+--------------------------------------------------------------
+
+[[SpringJavaConfig-Testing]]
+Testing
+^^^^^^^
+
+Since *Camel 2.11.0* you can use the `CamelSpringJUnit4ClassRunner` with
+`CamelSpringDelegatingTestContextLoader`. This is the recommended way to
+test Java Config and Camel integration.
+
+If you wish to create a collection of *RouteBuilder* instances then
+derive from the *CamelConfiguration* helper class and implement the
+*routes()* method. Keep in mind that (starting from the Camel 2.13.0) if
+you don't override *routes()* method, then *CamelConfiguration* will use
+all *RouteBuilder* instances available in the Spring context.
+
+The following
+http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java[example
+using Java Config] demonstrates how to test Java Config integration with
+Camel 2.10 and lower. Keep in mind that `JavaConfigContextLoader` is
+deprecated and could be removed in the future versions of Camel on the
+behalf of the `CamelSpringDelegatingTestContextLoader`.
+
+The *@ContextConfiguration* annotation tells the
+link:spring-testing.html[Spring Testing] framework to load the
+*ContextConfig* class as the configuration to use. This class derives
+from *SingleRouteCamelConfiguration* which is a helper Spring Java
+Config class which will configure the CamelContext for us and then
+register the RouteBuilder we create.

http://git-wip-us.apache.org/repos/asf/camel/blob/104532e7/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 5cf62e7..78e1546 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -250,6 +250,7 @@
     * [Spring-Boot](spring-boot.adoc)
     * [Spring-Event](spring-event.adoc)
     * [Spring-Integration](spring-integration.adoc)
+    * [Spring-Javaconfig](spring-java-config.adoc)
     * [Telegram](telegram.adoc)
     * [Twitter](twitter.adoc)
     * [Websocket](websocket.adoc)


[2/2] camel git commit: Added camel-spring-ldap docs to Gitbook

Posted by ac...@apache.org.
Added camel-spring-ldap 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/f0b95266
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f0b95266
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f0b95266

Branch: refs/heads/master
Commit: f0b952668c5a9819dd0d2f0221613495c043b864
Parents: 104532e
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Jun 7 15:38:20 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Jun 7 15:38:20 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/spring-ldap.adoc              | 113 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 114 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f0b95266/components/camel-spring-ldap/src/main/docs/spring-ldap.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-ldap/src/main/docs/spring-ldap.adoc b/components/camel-spring-ldap/src/main/docs/spring-ldap.adoc
new file mode 100644
index 0000000..a0f144f
--- /dev/null
+++ b/components/camel-spring-ldap/src/main/docs/spring-ldap.adoc
@@ -0,0 +1,113 @@
+[[SpringLDAP-SpringLDAPComponent]]
+Spring LDAP Component
+~~~~~~~~~~~~~~~~~~~~~
+
+*Available since Camel 2.11*
+
+The *spring-ldap:* component provides a Camel wrapper for
+http://www.springsource.org/ldap[Spring LDAP].
+
+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-spring-ldap</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[SpringLDAP-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+----------------------------------------
+spring-ldap:springLdapTemplate[?options]
+----------------------------------------
+
+Where *springLdapTemplate* is the name of the
+http://static.springsource.org/spring-ldap/site/apidocs/org/springframework/ldap/core/LdapTemplate.html[Spring
+LDAP Template bean]. In this bean, you configure the URL and the
+credentials for your LDAP access.
+
+[[SpringLDAP-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The Spring LDAP component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The Spring LDAP component supports 5 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| templateName | producer |  | String | *Required* Name of the Spring LDAP Template bean
+| operation | producer |  | LdapOperation | *Required* The LDAP operation to be performed.
+| scope | producer | subtree | String | The scope of the search operation.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+[[SpringLDAP-Usage]]
+Usage
+^^^^^
+
+The component supports producer endpoint only. An attempt to create a
+consumer endpoint will result in an `UnsupportedOperationException`. +
+ The body of the message must be a map (an instance of `java.util.Map`).
+This map must contain at least an entry with the key *`dn`* that
+specifies the root node for the LDAP operation to be performed. Other
+entries of the map are operation-specific (see below).
+
+The body of the message remains unchanged for the `bind` and `unbind`
+operations. For the `search` operation, the body is set to the result of
+the search, see
+http://static.springsource.org/spring-ldap/site/apidocs/org/springframework/ldap/core/LdapTemplate.html#search%28java.lang.String,%20java.lang.String,%20int,%20org.springframework.ldap.core.AttributesMapper%29[http://static.springsource.org/spring-ldap/site/apidocs/org/springframework/ldap/core/LdapTemplate.html#search%28java.lang.String,%20java.lang.String,%20int,%20org.springframework.ldap.core.AttributesMapper%29].
+
+[[SpringLDAP-Search]]
+Search
+++++++
+
+The message body must have an entry with the key *`filter`*. The value
+must be a String representing a valid LDAP filter, see
+http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol#Search_and_Compare[http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol#Search_and_Compare].
+
+[[SpringLDAP-Bind]]
+Bind
+++++
+
+The message body must have an entry with the key *`attributes`*. The
+value must be an instance of
+http://docs.oracle.com/javase/6/docs/api/javax/naming/directory/Attributes.html[javax.naming.directory.Attributes]
+This entry specifies the LDAP node to be created.
+
+[[SpringLDAP-Unbind]]
+Unbind
+++++++
+
+No further entries necessary, the node with the specified *`dn`* is
+deleted.
+
+*Key definitions*
+
+In order to avoid spelling errors, the following constants are defined
+in `org.apache.camel.springldap.SpringLdapProducer`:
+
+* public static final String DN = "dn"
+* public static final String FILTER = "filter"
+* public static final String ATTRIBUTES = "attributes"
+

http://git-wip-us.apache.org/repos/asf/camel/blob/f0b95266/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 78e1546..84796e7 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -251,6 +251,7 @@
     * [Spring-Event](spring-event.adoc)
     * [Spring-Integration](spring-integration.adoc)
     * [Spring-Javaconfig](spring-java-config.adoc)
+    * [Spring-Ldap](spring-ldap.adoc)
     * [Telegram](telegram.adoc)
     * [Twitter](twitter.adoc)
     * [Websocket](websocket.adoc)