CAMEL-7999: More components include documentation
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/be25326c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/be25326c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/be25326c Branch: refs/heads/master Commit: be25326c99e8c376eadc154398b7964a8056f9a2 Parents: 0eaff17 Author: Claus Ibsen <[email protected]> Authored: Sun Jan 4 11:06:54 2015 +0100 Committer: Claus Ibsen <[email protected]> Committed: Sun Jan 4 11:06:54 2015 +0100 ---------------------------------------------------------------------- .../component/springldap/SpringLdapComponent.java | 17 +++++++++-------- .../component/springldap/SpringLdapEndpoint.java | 13 +++++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/be25326c/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapComponent.java b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapComponent.java index 6447c4c..307ec0b 100644 --- a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapComponent.java +++ b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapComponent.java @@ -20,14 +20,18 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.spi.Registry; import org.springframework.ldap.core.LdapTemplate; /** * Creates endpoints for the Spring LDAP component. */ -public class SpringLdapComponent extends DefaultComponent { +public class SpringLdapComponent extends UriEndpointComponent { + + public SpringLdapComponent() { + super(SpringLdapEndpoint.class); + } /** * creates a Spring LDAP endpoint @@ -37,17 +41,14 @@ public class SpringLdapComponent extends DefaultComponent { * 'operation' is defined in org.apache.camel.component.springldap.LdapOperation. * 'scope' must be one of "object", "onelevel", or "subtree". */ - @Override - protected Endpoint createEndpoint(String uri, String remaining, - Map<String, Object> parameters) throws Exception { + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { CamelContext camelContext = getCamelContext(); + Registry registry = camelContext.getRegistry(); - LdapTemplate ldapTemplate = registry.lookupByNameAndType(remaining, - LdapTemplate.class); + LdapTemplate ldapTemplate = registry.lookupByNameAndType(remaining, LdapTemplate.class); Endpoint endpoint = new SpringLdapEndpoint(remaining, ldapTemplate); - setProperties(endpoint, parameters); return endpoint; } http://git-wip-us.apache.org/repos/asf/camel/blob/be25326c/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapEndpoint.java b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapEndpoint.java index 8b3c663..3b62a3e 100644 --- a/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapEndpoint.java +++ b/components/camel-spring-ldap/src/main/java/org/apache/camel/component/springldap/SpringLdapEndpoint.java @@ -19,15 +19,18 @@ package org.apache.camel.component.springldap; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; - import javax.naming.directory.SearchControls; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; import org.springframework.ldap.core.LdapTemplate; +@UriEndpoint(scheme = "spring-ldap", label = "spring,ldap") public class SpringLdapEndpoint extends DefaultEndpoint { private static final String OBJECT_SCOPE_NAME = "object"; @@ -38,9 +41,12 @@ public class SpringLdapEndpoint extends DefaultEndpoint { private static Map<String, Integer> scopeMap; private LdapTemplate ldapTemplate; + @UriPath + private String templateName; + @UriParam private LdapOperation operation; + @UriParam(defaultValue = "2") private int scope = SearchControls.SUBTREE_SCOPE; - private String templateName; /** * Initializes the SpringLdapEndpoint using the provided template @@ -107,8 +113,7 @@ public class SpringLdapEndpoint extends DefaultEndpoint { } /** - * sets the scope of the LDAP operation. The scope string must be one of "object", "onelevel", or "subtree" - * @param scope + * sets the scope of the LDAP operation. The scope string must be one of "object = 0", "onelevel = 1", or "subtree = 2" */ public void setScope(String scope) { for (Entry<String, Integer> allowedScope : scopeMap.entrySet()) {
