View Javadoc
1   /*
2    * Copyright 2013-2016 Brian Thomas Matthews
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.btmatthews.maven.plugins.ldap;
18  
19  import com.unboundid.ldap.sdk.LDAPInterface;
20  
21  import java.io.InputStream;
22  import java.io.OutputStream;
23  
24  /**
25   * The interface that is implemented by objects that handle the DSML and LDIF file formats.
26   *
27   * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
28   * @since 1.2.0
29   */
30  public interface FormatHandler {
31  
32      /**
33       * Reads directory entries from the input stream and loads them in the LDAP directory server.
34       *
35       * @param connection   The connection to the LDAP directory server.
36       * @param inputStream  The input stream from which directory entries will be read.
37       * @param ignoreErrors If {@code true} then loading will continue if an error occurs.
38       * @param logger       Used to log information or error messages.
39       */
40      void load(LDAPInterface connection, InputStream inputStream, boolean ignoreErrors, FormatLogger logger);
41  
42      /**
43       * Dump the results of a search against the LDAP directory server to an output stream.
44       *
45       * @param connection   The connection to the LDAP directory server.
46       * @param base         The base DN from which to start the search.
47       * @param filter       Query used to filter the directory entries.
48       * @param outputStream The output stream to which the directory entries are to be written.
49       * @param logger       Used to log information or error messages.
50       */
51      void dump(LDAPInterface connection, String base, String filter, OutputStream outputStream, FormatLogger logger);
52  }