You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/04/12 08:29:51 UTC

[1/3] camel git commit: update Spring LDAP component documentation to indicate that base DN is not needed if specified in ContextSource

Repository: camel
Updated Branches:
  refs/heads/master 49f2bb517 -> a41bef538


update Spring LDAP component documentation to indicate that base DN is not needed if specified in ContextSource


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

Branch: refs/heads/master
Commit: 764722269b7366956a8e379160d3ea27f07108d1
Parents: 152916a
Author: Ken Geis <kg...@berkeley.edu>
Authored: Tue Apr 4 12:16:43 2017 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 10:26:18 2017 +0200

----------------------------------------------------------------------
 .../camel-spring-ldap/src/main/docs/spring-ldap-component.adoc    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/76472226/components/camel-spring-ldap/src/main/docs/spring-ldap-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-spring-ldap/src/main/docs/spring-ldap-component.adoc b/components/camel-spring-ldap/src/main/docs/spring-ldap-component.adoc
index 07886ba..dd73c70 100644
--- a/components/camel-spring-ldap/src/main/docs/spring-ldap-component.adoc
+++ b/components/camel-spring-ldap/src/main/docs/spring-ldap-component.adoc
@@ -71,7 +71,8 @@ with the following path and query parameters:
 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`* (not needed for function_driven operation) that
+Unless a base DN is specified by in the configuration of your ContextSource,
+this map must contain at least an entry with the key *`dn`* (not needed for function_driven operation) that
 specifies the root node for the LDAP operation to be performed. Other
 entries of the map are operation-specific (see below).
 


[3/3] camel git commit: Fixed CS. This closes #1592

Posted by da...@apache.org.
Fixed CS. This closes #1592


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

Branch: refs/heads/master
Commit: a41bef53829213008b8a95b9b70d598738defe68
Parents: 7647222
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Apr 12 10:29:12 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 10:29:12 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/component/springldap/SpringLdapProducer.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a41bef53/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
index 84259c4..328dbd2 100644
--- a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
+++ b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.springldap;
 
 import java.util.Map;
 import java.util.function.BiFunction;
-
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.ModificationItem;
@@ -97,8 +96,8 @@ public class SpringLdapProducer extends DefaultProducer {
         if (StringUtils.isBlank(dn)) {
             ContextSource contextSource = ldapTemplate.getContextSource();
             if (contextSource instanceof BaseLdapPathContextSource) {
-		dn = ((BaseLdapPathContextSource) contextSource).getBaseLdapPathAsString();
-	    }
+                dn = ((BaseLdapPathContextSource) contextSource).getBaseLdapPathAsString();
+            }
         }
         if (operation != LdapOperation.FUNCTION_DRIVEN && (StringUtils.isBlank(dn))) {
             throw new UnsupportedOperationException("DN must not be empty, but you provided an empty DN");


[2/3] camel git commit: CAMEL-11060: fall back on base DN specified on Spring LDAP context source if none is defined in the URI

Posted by da...@apache.org.
CAMEL-11060: fall back on base DN specified on Spring LDAP context source if none is defined in the URI


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

Branch: refs/heads/master
Commit: 152916a772769414dbb8c1dce02304d7e2a88174
Parents: 49f2bb5
Author: Ken Geis <kg...@berkeley.edu>
Authored: Tue Apr 4 11:34:22 2017 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Apr 12 10:26:18 2017 +0200

----------------------------------------------------------------------
 .../camel/component/springldap/SpringLdapProducer.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/152916a7/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
index 23e2779..84259c4 100644
--- a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
+++ b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapProducer.java
@@ -27,8 +27,10 @@ import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.ldap.core.AttributesMapper;
+import org.springframework.ldap.core.ContextSource;
 import org.springframework.ldap.core.LdapOperations;
 import org.springframework.ldap.core.LdapTemplate;
+import org.springframework.ldap.core.support.BaseLdapPathContextSource;
 import org.springframework.ldap.query.LdapQueryBuilder;
 
 public class SpringLdapProducer extends DefaultProducer {
@@ -89,12 +91,19 @@ public class SpringLdapProducer extends DefaultProducer {
             throw new UnsupportedOperationException("LDAP operation must not be empty, but you provided an empty operation");
         }
 
+        LdapTemplate ldapTemplate = endpoint.getLdapTemplate();
+
         String dn = (String)body.get(DN);
+        if (StringUtils.isBlank(dn)) {
+            ContextSource contextSource = ldapTemplate.getContextSource();
+            if (contextSource instanceof BaseLdapPathContextSource) {
+		dn = ((BaseLdapPathContextSource) contextSource).getBaseLdapPathAsString();
+	    }
+        }
         if (operation != LdapOperation.FUNCTION_DRIVEN && (StringUtils.isBlank(dn))) {
             throw new UnsupportedOperationException("DN must not be empty, but you provided an empty DN");
         }
 
-        LdapOperations ldapTemplate = endpoint.getLdapTemplate();
         switch (operation) {
         case SEARCH:
             String filter = (String)body.get(FILTER);