Repository: camel Updated Branches: refs/heads/master ca52ba530 -> fec552e91
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/3a29be6a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3a29be6a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3a29be6a Branch: refs/heads/master Commit: 3a29be6af0de857e99d490a52f1bfacb89c8d403 Parents: ca52ba5 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Dec 19 14:12:06 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Dec 19 14:12:06 2014 +0100 ---------------------------------------------------------------------- .../camel/component/ldap/LdapComponent.java | 10 ++---- .../camel/component/ldap/LdapEndpoint.java | 32 +++++++++++++++++--- 2 files changed, 31 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/3a29be6a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapComponent.java b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapComponent.java index ee093c7..fffd1fc 100644 --- a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapComponent.java +++ b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapComponent.java @@ -18,22 +18,18 @@ package org.apache.camel.component.ldap; 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; /** * Represents the component that manages {@link LdapEndpoint}(s). * * @version */ -public class LdapComponent extends DefaultComponent { +public class LdapComponent extends UriEndpointComponent { public LdapComponent() { - } - - public LdapComponent(CamelContext context) { - super(context); + super(LdapEndpoint.class); } protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/3a29be6a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java index 67f5728..aa36e81 100644 --- a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java +++ b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java @@ -24,31 +24,40 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.RuntimeCamelException; import org.apache.camel.impl.DefaultEndpoint; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; /** * Represents an endpoint that synchronously invokes an LDAP server when a producer sends a message to it. */ +@UriEndpoint(scheme = "ldap", label = "ldap") public class LdapEndpoint extends DefaultEndpoint { public static final String SYSTEM_DN = "ou=system"; public static final String OBJECT_SCOPE = "object"; public static final String ONELEVEL_SCOPE = "onelevel"; public static final String SUBTREE_SCOPE = "subtree"; - private String remaining; + @UriPath + private String dirContextName; + @UriParam(defaultValue = SYSTEM_DN) private String base = SYSTEM_DN; + @UriParam(defaultValue = SUBTREE_SCOPE) private String scope = SUBTREE_SCOPE; + @UriParam private Integer pageSize; + @UriParam private String returnedAttributes; protected LdapEndpoint(String endpointUri, String remaining, LdapComponent component) throws URISyntaxException { super(endpointUri, component); - this.remaining = remaining; + this.dirContextName = remaining; } @SuppressWarnings("deprecation") public LdapEndpoint(String endpointUri, String remaining) throws URISyntaxException { super(endpointUri); - this.remaining = remaining; + this.dirContextName = remaining; } public Consumer createConsumer(Processor processor) throws Exception { @@ -56,13 +65,28 @@ public class LdapEndpoint extends DefaultEndpoint { } public Producer createProducer() throws Exception { - return new LdapProducer(this, remaining, base, toSearchControlScope(scope), pageSize, returnedAttributes); + return new LdapProducer(this, dirContextName, base, toSearchControlScope(scope), pageSize, returnedAttributes); } public boolean isSingleton() { return true; } + public String getDirContextName() { + return dirContextName; + } + + /** + * Name of {@link javax.naming.directory.DirContext} bean to lookup in the registry. + */ + public void setDirContextName(String dirContextName) { + this.dirContextName = dirContextName; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + public String getBase() { return base; }