001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * docs/licenses/cddl.txt
011     * or http://www.opensource.org/licenses/cddl1.php.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * docs/licenses/cddl.txt.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2010-2013 UnboundID Corp.
026     */
027    package com.unboundid.directory.sdk.proxy.types;
028    
029    
030    
031    import java.util.List;
032    
033    import com.unboundid.directory.sdk.common.types.OperationType;
034    import com.unboundid.ldap.sdk.LDAPConnection;
035    import com.unboundid.ldap.sdk.LDAPConnectionOptions;
036    import com.unboundid.ldap.sdk.LDAPException;
037    import com.unboundid.util.NotExtensible;
038    import com.unboundid.util.ThreadSafety;
039    import com.unboundid.util.ThreadSafetyLevel;
040    
041    
042    
043    /**
044     * This interface defines a set of methods that may be used to interact with a
045     * set of backend servers to be accessed through an entry-balancing request
046     * processor.  All the servers in the set will have an identical set of data
047     * for the entry-balanced portion.
048     */
049    @NotExtensible()
050    @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
051    public interface BackendSet
052    {
053      /**
054       * Retrieves the DN of the configuration entry for the proxying request
055       * processor that defines this backend set.
056       *
057       * @return  The DN of the configuration entry for the proxying request
058       *          processor that defines this backend set.
059       */
060      String getConfigEntryDN();
061    
062    
063    
064      /**
065       * Retrieves the list of servers associated with this backend set.
066       *
067       * @return  The list of servers associated with this backend set.
068       */
069      List<BackendServer> getBackendServers();
070    
071    
072    
073      /**
074       * Retrieves a newly-established connection to one of the servers in this
075       * backend set which is capable of processing all of the specified types of
076       * operations.  The caller is responsible for closing the connection when it
077       * is no longer needed.
078       *
079       * @param  options  The set of connection options to use for the connection.
080       *                  It may be {@code null} if a default set of connection
081       *                  options should be used.
082       * @param  opTypes  The types of operations expected to be processed on the
083       *                  connection that is created.  It must not be {@code null}
084       *                  or empty.
085       *
086       * @return  The newly-created connection to one of the servers in this backend
087       *          set.
088       *
089       * @throws  LDAPException  If a problem occurred while attempting to create
090       *                         the connection, or if none of the backend servers
091       *                         is available for the provided set of operation
092       *                         types.
093       */
094      LDAPConnection getConnection(final LDAPConnectionOptions options,
095                                   final OperationType... opTypes)
096                     throws LDAPException;
097    }