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-2014 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 a unique identifier for this backend set.
055       *
056       * @return  A unique identifier for this backend set.
057       */
058      String getBackendSetID();
059    
060    
061    
062      /**
063       * Retrieves the DN of the configuration entry for the proxying request
064       * processor that defines this backend set.
065       *
066       * @return  The DN of the configuration entry for the proxying request
067       *          processor that defines this backend set.
068       */
069      String getConfigEntryDN();
070    
071    
072    
073      /**
074       * Retrieves the list of servers associated with this backend set.
075       *
076       * @return  The list of servers associated with this backend set.
077       */
078      List<BackendServer> getBackendServers();
079    
080    
081    
082      /**
083       * Retrieves a newly-established connection to one of the servers in this
084       * backend set which is capable of processing all of the specified types of
085       * operations.  The caller is responsible for closing the connection when it
086       * is no longer needed.
087       *
088       * @param  options  The set of connection options to use for the connection.
089       *                  It may be {@code null} if a default set of connection
090       *                  options should be used.
091       * @param  opTypes  The types of operations expected to be processed on the
092       *                  connection that is created.  It must not be {@code null}
093       *                  or empty.
094       *
095       * @return  The newly-created connection to one of the servers in this backend
096       *          set.
097       *
098       * @throws  LDAPException  If a problem occurred while attempting to create
099       *                         the connection, or if none of the backend servers
100       *                         is available for the provided set of operation
101       *                         types.
102       */
103      LDAPConnection getConnection(final LDAPConnectionOptions options,
104                                   final OperationType... opTypes)
105                     throws LDAPException;
106    }