Added LDIF component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c91fdeda Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c91fdeda Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c91fdeda Branch: refs/heads/master Commit: c91fdedacbb5f99db5cb5a21b6dc95b278e0c361 Parents: 0229cbc Author: Tim Hurman <k...@kano.org.uk> Authored: Sat Sep 23 14:42:57 2017 +0800 Committer: Tim Hurman <k...@kano.org.uk> Committed: Sat Sep 23 14:42:57 2017 +0800 ---------------------------------------------------------------------- .../src/main/descriptors/common-bin.xml | 2 + components/camel-ldif/pom.xml | 113 ++++++ .../src/main/docs/ldif-component.adoc | 178 +++++++++ .../camel/component/ldif/LdifComponent.java | 37 ++ .../camel/component/ldif/LdifEndpoint.java | 74 ++++ .../camel/component/ldif/LdifProducer.java | 225 ++++++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../services/org/apache/camel/component/ldif | 18 + .../camel/component/ldif/LdifRouteTest.java | 361 +++++++++++++++++++ .../src/test/resources/log4j2-test.xml | 46 +++ .../camel/component/ldif/AddDuplicate.ldif | 33 ++ .../camel/component/ldif/AddDuplicateSetup.ldif | 39 ++ .../org/apache/camel/component/ldif/AddOne.ldif | 39 ++ .../apache/camel/component/ldif/DeleteOne.ldif | 27 ++ .../camel/component/ldif/DeleteOneSetup.ldif | 39 ++ .../org/apache/camel/component/ldif/ModDn.ldif | 29 ++ .../apache/camel/component/ldif/ModDnSetup.ldif | 45 +++ .../org/apache/camel/component/ldif/ModRdn.ldif | 28 ++ .../camel/component/ldif/ModRdnSetup.ldif | 39 ++ .../org/apache/camel/component/ldif/Modify.ldif | 30 ++ .../camel/component/ldif/ModifySetup.ldif | 39 ++ components/pom.xml | 1 + .../features/src/main/resources/features.xml | 5 + .../camel-ldif-starter/pom.xml | 53 +++ .../LdifComponentAutoConfiguration.java | 128 +++++++ .../springboot/LdifComponentConfiguration.java | 50 +++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../main/resources/META-INF/spring.factories | 19 + .../src/main/resources/META-INF/spring.provides | 17 + .../spring-boot/components-starter/pom.xml | 1 + 32 files changed, 2143 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/apache-camel/src/main/descriptors/common-bin.xml ---------------------------------------------------------------------- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index b3d3974..646adcc 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -166,6 +166,7 @@ <include>org.apache.camel:camel-kura</include> <include>org.apache.camel:camel-kubernetes</include> <include>org.apache.camel:camel-ldap</include> + <include>org.apache.camel:camel-ldif</include> <include>org.apache.camel:camel-leveldb</include> <include>org.apache.camel:camel-linkedin-api</include> <include>org.apache.camel:camel-linkedin</include> @@ -458,6 +459,7 @@ <include>org.apache.camel:camel-kubernetes-starter</include> <include>org.apache.camel:camel-kura-starter</include> <include>org.apache.camel:camel-ldap-starter</include> + <include>org.apache.camel:camel-ldif-starter</include> <include>org.apache.camel:camel-leveldb-starter</include> <include>org.apache.camel:camel-linkedin-starter</include> <include>org.apache.camel:camel-lucene-starter</include> http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-ldif/pom.xml b/components/camel-ldif/pom.xml new file mode 100644 index 0000000..887d4c1 --- /dev/null +++ b/components/camel-ldif/pom.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>2.20.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-ldif</artifactId> + <packaging>jar</packaging> + <name>Camel :: LDIF</name> + <description>Camel LDIF support</description> + + <properties> + <camel.osgi.export.pkg>org.apache.camel.component.ldif.*</camel.osgi.export.pkg> + <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=ldif</camel.osgi.export.service> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core-api</artifactId> + <version>${apacheds-version}</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-server-integ</artifactId> + <version>${apacheds-version}</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core-integ</artifactId> + <version>${apacheds-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.mina</groupId> + <artifactId>mina-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-1.2-api</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/docs/ldif-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/docs/ldif-component.adoc b/components/camel-ldif/src/main/docs/ldif-component.adoc new file mode 100644 index 0000000..2b218ce --- /dev/null +++ b/components/camel-ldif/src/main/docs/ldif-component.adoc @@ -0,0 +1,178 @@ +== LDIF Component + +*Available as of Camel version 1.0* + +The *ldif* component allows you to do updates on an LDAP server +from a LDIF body content. + + This component uses a basic URL syntax to access the server. It uses +the Apache DS LDAP library to process the LDIF. After processing the LDIF, +the response body will be a list of statuses for success/failure of each +entry. + +Note that the Apache LDAP API is very sensitive to LDIF syntax errors. If in doubt, +refer to the unit tests to see an example of each change type. + +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-ldif</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +------------------------------------------------------------ + +### URI format + +[source,java] +---------------------------------------- +ldap:ldapServerBean[?options] +---------------------------------------- + +The _ldapServerBean_ portion of the URI refers to a +https://directory.apache.org/api/gen-docs/latest/apidocs/org/apache/directory/ldap/client/api/LdapConnection.html[LdapConnection]. +This should be constructed from a factory at the point of use to avoid connection timeouts. The LDIF component only supports producer +endpoints, which means that an `ldif` URI cannot appear in the `from` at +the start of a route. + +For SSL configuration, refer to the `camel-ldap` component where there is an example +of setting up a custom SocketFactory instance. + +You can append query options to the URI in the following format, +`?option=value&option=value&...` + +### Options + +// component options: START +The LDIF component has no options. +// component options: END + +// endpoint options: START +The LDIF endpoint is configured using URI syntax: + +---- +ldif:ldapConnectionName +---- + +with the following path and query parameters: + +==== Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *ldapConnectionName* | *Required* The name of the LdapConnection bean to pull from the registry. Note that this must be of scope prototype to avoid it being shared among threads or using a connection that has timed out. | | String +|=== + +==== Query Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +|=== +// endpoint options: END + +### Body types: + +The body can be a URL to an LDIF file or an inline LDIF file. To signify the difference +in body types, an inline LDIF must start with: + +[source,ldif] +----------- +version: 1 +----------- + +If not, the component will try to parse the body as a URL. + +### Result + +The result is returned in the Out body as a `ArrayList<java.lang.String>` object. +This contains either "success" or an Exception message for each LDIF entry. + +### LdapConnection + +The URI, `ldif:ldapConnectionName`, references a bean with the ID, +`ldapConnectionName`. The ldapConnection can be configured using a +`LdapConnectionConfig` bean. Note that the scope must have a scope of +`prototype` to avoid the connection being shared or picking up a +stale connection. + +The `LdapConnection` bean may be defined as follows in Spring XML: + +[source,xml] +-------------------------------------------------------------------------------------------------- +<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig"> + <property name="ldapHost" value="${ldap.host}"/> + <property name="ldapPort" value="${ldap.port}"/> + <property name="name" value="${ldap.username}"/> + <property name="credentials" value="${ldap.password}"/> + <property name="useSsl" value="false"/> + <property name="useTls" value="false"/> +</bean> + +<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory"> + <constructor-arg index="0" ref="ldapConnectionOptions"/> +</bean> + +<bean id="ldapConnection" factory-bean="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/> +-------------------------------------------------------------------------------------------------- + +or in a blueprint.xml: +-------------------------------------------------------------------------------------------------- +<bean id="ldapConnectionOptions" class="org.apache.directory.ldap.client.api.LdapConnectionConfig"> + <property name="ldapHost" value="${ldap.host}"/> + <property name="ldapPort" value="${ldap.port}"/> + <property name="name" value="${ldap.username}"/> + <property name="credentials" value="${ldap.password}"/> + <property name="useSsl" value="false"/> + <property name="useTls" value="false"/> +</bean> + +<bean id="ldapConnectionFactory" class="org.apache.directory.ldap.client.api.DefaultLdapConnectionFactory"> + <argument ref="ldapConnectionOptions"/> +</bean> + +<bean id="ldapConnection" factory-ref="ldapConnectionFactory" factory-method="newLdapConnection" scope="prototype"/> +-------------------------------------------------------------------------------------------------- + + +### Samples + +Following on from the Spring configuration above, the code sample below +sends an LDAP request to filter search a group for a member. The Common +Name is then extracted from the response. + +[source,java] +---------------------------------------------------------- +ProducerTemplate<Exchange> template = exchange + .getContext().createProducerTemplate(); + +List<?> results = (Collection<?>) (template + .sendBody( + "ldap:ldapConnection, + "FIXME - inline LDIF")); + +if (results.size() > 0) { + // Check for no errors + + for (String result: results) { + if ("success".equalTo(result)) { + // LDIF entry success + } else { + // LDIF entry failure + } + } +} +---------------------------------------------------------- + +### See Also + +* link:configuring-camel.html[Configuring Camel] +* link:component.html[Component] +* link:endpoint.html[Endpoint] + +* link:getting-started.html[Getting Started] http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifComponent.java b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifComponent.java new file mode 100644 index 0000000..6f5e073 --- /dev/null +++ b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifComponent.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ldif; + +import java.util.Map; + +import org.apache.camel.Endpoint; +import org.apache.camel.impl.DefaultComponent; + +/** + * Represents the component that manages {@link LdifEndpoint}(s). + * + * @version + */ +public class LdifComponent extends DefaultComponent { + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + Endpoint endpoint = new LdifEndpoint(uri, remaining, this); + setProperties(endpoint, parameters); + return endpoint; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifEndpoint.java b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifEndpoint.java new file mode 100644 index 0000000..cde7712 --- /dev/null +++ b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifEndpoint.java @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ldif; + +import java.net.URISyntaxException; + +import org.apache.camel.Consumer; +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.Metadata; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriPath; + +/** + * The ldif component allows you to process an LDIF body content on an LDAP + * servers. + */ +@UriEndpoint(firstVersion = "1.0.0", scheme = "ldif", title = "LDIF", syntax = "ldif:ldapConnectionName", producerOnly = true, label = "ldif") +public class LdifEndpoint extends DefaultEndpoint { + @UriPath + @Metadata(required = "true") + private String ldapConnectionName; + + protected LdifEndpoint(String endpointUri, String remaining, LdifComponent component) throws URISyntaxException { + super(endpointUri, component); + this.ldapConnectionName = remaining; + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + throw new RuntimeCamelException("An LDIF Consumer would be the LDAP server itself! No such support here"); + } + + @Override + public Producer createProducer() throws Exception { + return new LdifProducer(this, ldapConnectionName); + } + + @Override + public boolean isSingleton() { + return true; + } + + public String getLdapConnectionName() { + return ldapConnectionName; + } + + /** + * The name of the LdapConnection bean to pull from the registry. Note that + * this must be of scope "prototype" to avoid it being shared among threads + * or using a connection that has timed out. + * + * @param ldapConnectionName + */ + public void setLdapConnectionName(String ldapConnectionName) { + this.ldapConnectionName = ldapConnectionName; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifProducer.java b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifProducer.java new file mode 100644 index 0000000..5cef189 --- /dev/null +++ b/components/camel-ldif/src/main/java/org/apache/camel/component/ldif/LdifProducer.java @@ -0,0 +1,225 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ldif; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.camel.CamelException; +import org.apache.camel.Exchange; +import org.apache.camel.InvalidPayloadException; +import org.apache.camel.impl.DefaultProducer; +import org.apache.directory.api.ldap.model.exception.LdapException; +import org.apache.directory.api.ldap.model.ldif.LdifEntry; +import org.apache.directory.api.ldap.model.ldif.LdifReader; +import org.apache.directory.api.ldap.model.name.Dn; +import org.apache.directory.api.ldap.model.name.Rdn; +import org.apache.directory.ldap.client.api.LdapConnection; + +/** + * LDIF Producer. This is the main processor that reads LDIF data/URLs and + * executes them against an LdapConnection. + * + * @version $ + */ +public class LdifProducer extends DefaultProducer { + // Constants + private static final String LDIF_HEADER = "version: 1"; + + // properties + private String ldapConnectionName; + + /** + * @param endpoint + * @throws Exception + */ + public LdifProducer(LdifEndpoint endpoint, String ldapConnectionName) throws Exception { + super(endpoint); + + this.ldapConnectionName = ldapConnectionName; + } + + /** + * Process the body. There are two options: + * <ol> + * <li>A String body that is the LDIF content. This needs to start with + * "version: 1".</li> + * <li>A String body that is a URL to ready the LDIF content from</li> + * </ol> + * + * @see org.apache.camel.impl.DefaultProducer#process(Exchange) + */ + public void process(Exchange exchange) throws Exception { + String body = exchange.getIn().getBody(String.class); + List<String> result = null; + + // Pass through everything + exchange.setOut(exchange.getIn()); + + // If nothing to do, then return an empty body + if (null == body || "".equals(body)) { + exchange.getOut().setBody(""); + } else if (body.startsWith(LDIF_HEADER)) { + if (log.isDebugEnabled()) { + log.debug("reading from LDIF body"); + } + result = processLdif(new StringReader(body)); + } else { + URL loc = null; + try { + loc = new URL(body); + if (log.isDebugEnabled()) { + log.debug("reading from URL: " + loc); + } + result = processLdif(new InputStreamReader(loc.openStream())); + } catch (MalformedURLException e) { + if (log.isDebugEnabled()) { + log.debug("Failed to parse body as URL and LDIF", e); + } + throw new InvalidPayloadException(exchange, String.class); + } + } + + exchange.getOut().setBody(result); + } + + /** + * Get the LdapConnection. Since the object is a factory, we'll just call + * that. A future enhancement is to use the ApacheDS LdapConnectionPool + * object to keep a pool of working connections that avoids the connection + * pause. + * + * @return The created LDAP connection. + */ + protected LdapConnection getLdapConnection() throws CamelException { + return (LdapConnection)getEndpoint().getCamelContext().getRegistry().lookupByName(ldapConnectionName); + } + + /** + * Process an LDIF file from a reader. + * + * @param ldifReader + * @return + */ + private List<String> processLdif(Reader reader) throws CamelException { + LdapConnection conn = getLdapConnection(); + LdifReader ldifReader = null; + List<String> results = new ArrayList<String>(); + + // Create the reader + try { + ldifReader = new LdifReader(reader); + } catch (LdapException e) { + throw new CamelException("Unable to create LDIF reader", e); + } + + // Process each entry + for (LdifEntry e : ldifReader) { + results.add(processLdifEntry(conn, e)); + } + + // Cleanup + try { + conn.close(); + } catch (IOException e) { + if (log.isDebugEnabled()) { + log.debug("failed to close the LDAP connection", e); + } + } + try { + ldifReader.close(); + } catch (IOException e) { + if (log.isDebugEnabled()) { + log.debug("failed to close LDIF reader", e); + } + } + + return results; + } + + /** + * Figure out the change is and what to do about it. + * + * @param conn + * @param ldifEntry + * @return A success/failure message + */ + private String processLdifEntry(LdapConnection conn, LdifEntry ldifEntry) { + try { + if (ldifEntry.isChangeAdd() || ldifEntry.isLdifContent()) { + if (log.isDebugEnabled()) { + log.debug("attempting add of " + ldifEntry.toString()); + } + conn.add(ldifEntry.getEntry()); + } else if (ldifEntry.isChangeModify()) { + if (log.isDebugEnabled()) { + log.debug("attempting modify of " + ldifEntry.toString()); + } + conn.modify(ldifEntry.getDn(), ldifEntry.getModificationArray()); + } else if (ldifEntry.isChangeDelete()) { + if (log.isDebugEnabled()) { + log.debug("attempting delete of " + ldifEntry.toString()); + } + conn.delete(ldifEntry.getDn()); + } else if (ldifEntry.isChangeModDn()) { + if (log.isDebugEnabled()) { + log.debug("attempting DN move of " + ldifEntry.toString()); + } + conn.moveAndRename(ldifEntry.getDn(), new Dn(ldifEntry.getNewRdn(), ldifEntry.getNewSuperior()), ldifEntry.isDeleteOldRdn()); + } else if (ldifEntry.isChangeModRdn()) { + if (log.isDebugEnabled()) { + log.debug("attempting RDN move of " + ldifEntry.toString()); + } + conn.rename(ldifEntry.getDn(), new Rdn(ldifEntry.getNewRdn()), ldifEntry.isDeleteOldRdn()); + } + + if (log.isDebugEnabled()) { + log.debug("ldif success"); + } + return "success"; + } catch (LdapException e) { + if (log.isDebugEnabled()) { + log.debug("failed to apply ldif", e); + } + return getRootCause(e); + } + } + + /** + * Get the root cause of an exception + * + * @param e + * @return + */ + private String getRootCause(LdapException e) { + Throwable oldt; + Throwable thist; + + oldt = thist = e; + while (thist != null) { + oldt = thist; + thist = thist.getCause(); + } + return oldt.getMessage(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/resources/META-INF/LICENSE.txt ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/resources/META-INF/LICENSE.txt b/components/camel-ldif/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/components/camel-ldif/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/resources/META-INF/NOTICE.txt ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/resources/META-INF/NOTICE.txt b/components/camel-ldif/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/components/camel-ldif/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/main/resources/META-INF/services/org/apache/camel/component/ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/main/resources/META-INF/services/org/apache/camel/component/ldif b/components/camel-ldif/src/main/resources/META-INF/services/org/apache/camel/component/ldif new file mode 100644 index 0000000..07b0189 --- /dev/null +++ b/components/camel-ldif/src/main/resources/META-INF/services/org/apache/camel/component/ldif @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.ldif.LdifComponent http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java new file mode 100644 index 0000000..be17da2 --- /dev/null +++ b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java @@ -0,0 +1,361 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.ldif; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.List; + +import javax.naming.NamingEnumeration; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import javax.naming.ldap.LdapContext; + +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.impl.SimpleRegistry; +import org.apache.directory.server.annotations.CreateLdapServer; +import org.apache.directory.server.annotations.CreateTransport; +import org.apache.directory.server.core.annotations.ApplyLdifFiles; +import org.apache.directory.server.core.integ.AbstractLdapTestUnit; +import org.apache.directory.server.core.integ.FrameworkRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection; +import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +@RunWith(FrameworkRunner.class) +@CreateLdapServer(transports = {@CreateTransport(protocol = "LDAP")}) +public class LdifRouteTest extends AbstractLdapTestUnit { + // Constants + private static final String LDAP_CONN_NAME = "conn"; + private static final String ENDPOINT_LDIF = "ldif:" + LDAP_CONN_NAME; + private static final String ENDPOINT_START = "direct:start"; + private static final SearchControls SEARCH_CONTROLS = new SearchControls(SearchControls.SUBTREE_SCOPE, 0, 0, null, true, true); + + // Properties + private CamelContext camel; + private ProducerTemplate template; + private LdapContext ldapContext; + + @Before + public void setup() throws Exception { + // Create the LDAPConnection + ldapContext = getWiredContext(ldapServer); + + SimpleRegistry reg = new SimpleRegistry(); + reg.put(LDAP_CONN_NAME, getWiredConnection(ldapServer)); + camel = new DefaultCamelContext(reg); + template = camel.createProducerTemplate(); + } + + @After + public void tearDown() throws Exception { + camel.stop(); + } + + @Test + public void addOne() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/AddOne.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(2)); // Container and user + assertThat(ldifResults.get(0), equalTo("success")); + assertThat(ldifResults.get(1), equalTo("success")); + + // Check LDAP + SearchResult sr; + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertNotNull(searchResults); + sr = searchResults.next(); + assertNotNull(sr); + assertThat("uid=test1,ou=test,ou=system", equalTo(sr.getName())); + assertThat(false, equalTo(searchResults.hasMore())); + } + + @Test + public void addOneInline() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/AddOne.ldif"); + exchange.getIn().setBody(readUrl(loc)); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(2)); // Container and user + assertThat(ldifResults.get(0), equalTo("success")); + assertThat(ldifResults.get(1), equalTo("success")); + + // Check LDAP + SearchResult sr; + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertNotNull(searchResults); + sr = searchResults.next(); + assertNotNull(sr); + assertThat("uid=test1,ou=test,ou=system", equalTo(sr.getName())); + assertThat(false, equalTo(searchResults.hasMore())); + } + + + @Test + @ApplyLdifFiles({"org/apache/camel/component/ldif/DeleteOneSetup.ldif"}) + public void deleteOne() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/DeleteOne.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(1)); + assertThat(ldifResults.get(0), equalTo("success")); + + // Check LDAP + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertThat(false, equalTo(searchResults.hasMore())); + } + + @Test + @ApplyLdifFiles({"org/apache/camel/component/ldif/AddDuplicateSetup.ldif"}) + public void addDuplicate() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/AddDuplicate.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(1)); + assertThat(ldifResults.get(0), not(equalTo("success"))); + } + + @Test + @ApplyLdifFiles({"org/apache/camel/component/ldif/ModifySetup.ldif"}) + public void modify() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/Modify.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(1)); + assertThat(ldifResults.get(0), equalTo("success")); + + // Check LDAP + SearchResult sr; + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertNotNull(searchResults); + sr = searchResults.next(); + assertNotNull(sr); + assertThat("uid=test4,ou=test,ou=system", equalTo(sr.getName())); + + // Check the attributes of the search result + Attributes attribs = sr.getAttributes(); + assertNotNull(attribs); + Attribute attrib = attribs.get("sn"); + assertNotNull(attribs); + assertThat(1, equalTo(attrib.size())); + assertThat("5", equalTo(attrib.get(0).toString())); + + // Check no more results + assertThat(false, equalTo(searchResults.hasMore())); + } + + @Test + @ApplyLdifFiles({"org/apache/camel/component/ldif/ModRdnSetup.ldif"}) + public void modRdn() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/ModRdn.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(1)); + assertThat(ldifResults.get(0), equalTo("success")); + + // Check LDAP + SearchResult sr; + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertNotNull(searchResults); + sr = searchResults.next(); + assertNotNull(sr); + + // Check the DN + assertThat("uid=test6,ou=test,ou=system", equalTo(sr.getName())); + + // Check no more results + assertThat(false, equalTo(searchResults.hasMore())); + } + + @Test + @ApplyLdifFiles({"org/apache/camel/component/ldif/ModDnSetup.ldif"}) + public void modDn() throws Exception { + camel.addRoutes(createRouteBuilder(ENDPOINT_LDIF)); + camel.start(); + + Endpoint endpoint = camel.getEndpoint(ENDPOINT_START); + Exchange exchange = endpoint.createExchange(); + + // then we set the LDAP filter on the in body + URL loc = this.getClass().getResource("/org/apache/camel/component/ldif/ModDn.ldif"); + exchange.getIn().setBody(loc.toString()); + + // now we send the exchange to the endpoint, and receives the response + // from Camel + Exchange out = template.send(endpoint, exchange); + + // Check the results + List<String> ldifResults = defaultLdapModuleOutAssertions(out); + assertThat(ldifResults, notNullValue()); + assertThat(ldifResults.size(), equalTo(1)); + assertThat(ldifResults.get(0), equalTo("success")); + + // Check LDAP + SearchResult sr; + NamingEnumeration<SearchResult> searchResults = ldapContext.search("", "(uid=test*)", SEARCH_CONTROLS); + assertNotNull(searchResults); + sr = searchResults.next(); + assertNotNull(sr); + + // Check the DN + assertThat("uid=test7,ou=testnew,ou=system", equalTo(sr.getName())); + + // Check no more results + assertThat(false, equalTo(searchResults.hasMore())); + } + + @SuppressWarnings("unchecked") + private List<String> defaultLdapModuleOutAssertions(Exchange out) { + // assertions of the response + assertNotNull(out); + assertNotNull(out.getOut()); + List<String> data = out.getOut().getBody(List.class); + assertNotNull("out body could not be converted to a List - was: " + out.getOut().getBody(), data); + return data; + } + + protected RouteBuilder createRouteBuilder(final String ldapEndpointUrl) throws Exception { + return new RouteBuilder() { + // START SNIPPET: route + @Override + public void configure() throws Exception { + from(ENDPOINT_START).to(ldapEndpointUrl); + } + // END SNIPPET: route + }; + } + + /** + * Read the contents of a URL into a String + * @param in + * @return + * @throws IOException + */ + private String readUrl(URL in) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(in.openStream())); + StringBuffer buf = new StringBuffer(); + String s; + + while (null != (s = br.readLine())) { + buf.append(s); + buf.append('\n'); + } + return buf.toString(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/log4j2-test.xml ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/log4j2-test.xml b/components/camel-ldif/src/test/resources/log4j2-test.xml new file mode 100644 index 0000000..77e204a --- /dev/null +++ b/components/camel-ldif/src/test/resources/log4j2-test.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<Configuration status="WARN"> + <Appenders> + <Console name="stdout"> + <PatternLayout pattern="[%30.30t] %-30.30c{1} %-5p %m%n" /> + </Console> + <File name="out" fileName="target/camel-ldif-test.log" bufferedIO="true" immediateFlush="true"> + <PatternLayout pattern="%d [%-15.15t] %-5p %-30.30c{1} - %m%n" /> + </File> + </Appenders> + + <Loggers> + <Logger name="org.springframework" level="warn"> + </Logger> + + <Logger name="org.apache.directory" level="warn"> + </Logger> + + <Logger name="org.apache.camel.component.ldif" level="trace" additivity="false"> + <AppenderRef ref="out"/> + </Logger> + + <Root level="info"> + <AppenderRef ref="out" /> + <AppenderRef ref="stdout" /> + </Root> + </Loggers> +</Configuration> http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicate.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicate.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicate.ldif new file mode 100644 index 0000000..4a54d31 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicate.ldif @@ -0,0 +1,33 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: uid=test3,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 3 +uid: test3 +sn: 3 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicateSetup.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicateSetup.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicateSetup.ldif new file mode 100644 index 0000000..5a8c194 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddDuplicateSetup.ldif @@ -0,0 +1,39 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: uid=test3,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 3 +uid: test3 +sn: 3 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddOne.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddOne.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddOne.ldif new file mode 100644 index 0000000..e9150bd --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/AddOne.ldif @@ -0,0 +1,39 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: uid=test1,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 1 +uid: test1 +sn: 1 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOne.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOne.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOne.ldif new file mode 100644 index 0000000..e4e63e2 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOne.ldif @@ -0,0 +1,27 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: uid=test2,ou=test,ou=system +changetype: delete + http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOneSetup.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOneSetup.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOneSetup.ldif new file mode 100644 index 0000000..9c1aef4 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/DeleteOneSetup.ldif @@ -0,0 +1,39 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: uid=test2,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 2 +uid: test2 +sn: 2 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDn.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDn.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDn.ldif new file mode 100644 index 0000000..decf63f --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDn.ldif @@ -0,0 +1,29 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: uid=test7,ou=test,ou=system +changetype: moddn +newrdn: uid=test7 +deleteoldrdn: 1 +newsuperior: ou=testnew,ou=system http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDnSetup.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDnSetup.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDnSetup.ldif new file mode 100644 index 0000000..2caeac6 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModDnSetup.ldif @@ -0,0 +1,45 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: ou=testnew,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: testnew + +dn: uid=test7,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 7 +uid: test7 +sn: 7 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdn.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdn.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdn.ldif new file mode 100644 index 0000000..4ec728d --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdn.ldif @@ -0,0 +1,28 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: uid=test5,ou=test,ou=system +changetype: modrdn +newrdn: uid=test6 +deleteoldrdn: 1 http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdnSetup.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdnSetup.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdnSetup.ldif new file mode 100644 index 0000000..2562390 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModRdnSetup.ldif @@ -0,0 +1,39 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: uid=test5,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 5 +uid: test5 +sn: 5 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/Modify.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/Modify.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/Modify.ldif new file mode 100644 index 0000000..920de29 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/Modify.ldif @@ -0,0 +1,30 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: uid=test4,ou=test,ou=system +changetype: modify +replace: sn +sn: 5 +- +# Note that ApacheDS is really sensitive about the trailing '-' http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModifySetup.ldif ---------------------------------------------------------------------- diff --git a/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModifySetup.ldif b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModifySetup.ldif new file mode 100644 index 0000000..2270a49 --- /dev/null +++ b/components/camel-ldif/src/test/resources/org/apache/camel/component/ldif/ModifySetup.ldif @@ -0,0 +1,39 @@ +version: 1 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# EXAMPLE.COM is reserved for testing according to this RFC: +# +# http://www.rfc-editor.org/rfc/rfc2606.txt +# + +dn: ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalUnit +ou: test + +dn: uid=test4,ou=test,ou=system +changetype: add +objectClass: top +objectClass: organizationalPerson +objectclass: inetOrgPerson +cn: Test 4 +uid: test4 +sn: 4 +gn: Test http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/components/pom.xml ---------------------------------------------------------------------- diff --git a/components/pom.xml b/components/pom.xml index b5f30b3..78570ef 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -191,6 +191,7 @@ <module>camel-kubernetes</module> <module>camel-kura</module> <module>camel-ldap</module> + <module>camel-ldif</module> <module>camel-leveldb</module> <module>camel-linkedin</module> <module>camel-lucene</module> http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/platforms/karaf/features/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 9b85040..31e3cc7 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -1280,6 +1280,11 @@ <feature version='${project.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-ldap/${project.version}</bundle> </feature> + <feature name='camel-ldif' version='${project.version}' resolver='(obr)' start-level='50'> + <feature version='${project.version}'>camel-core</feature> + <bundle dependency='true'>mvn:org.apache.directory.server/apacheds-core-api/${apacheds-version}</bundle> + <bundle>mvn:org.apache.camel/camel-ldif/${project.version}</bundle> + </feature> <feature name='camel-linkedin' version='${project.version}' resolver='(obr)' start-level='50'> <feature>aries-blueprint</feature> <feature version='${project.version}'>camel-core</feature> http://git-wip-us.apache.org/repos/asf/camel/blob/c91fdeda/platforms/spring-boot/components-starter/camel-ldif-starter/pom.xml ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ldif-starter/pom.xml b/platforms/spring-boot/components-starter/camel-ldif-starter/pom.xml new file mode 100644 index 0000000..3c1e073 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ldif-starter/pom.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components-starter</artifactId> + <version>2.20.0-SNAPSHOT</version> + </parent> + <artifactId>camel-ldif-starter</artifactId> + <packaging>jar</packaging> + <name>Spring-Boot Starter :: Camel :: LDIF</name> + <description>Spring-Boot Starter for Camel LDIF support</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-ldif</artifactId> + <version>${project.version}</version> + </dependency> + <!--START OF GENERATED CODE--> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <!--END OF GENERATED CODE--> + </dependencies> +</project>