| | |
| | | |
| | | |
| | | |
| | | import java.util.*; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | |
| | | import org.glassfish.grizzly.nio.transport.TCPNIOTransport; |
| | | |
| | | import com.sun.opends.sdk.util.Validator; |
| | | |
| | | |
| | |
| | | /** |
| | | * Common options for LDAP client connections. |
| | | */ |
| | | public class LDAPOptions |
| | | public final class LDAPOptions |
| | | { |
| | | private SSLContext sslContext; |
| | | |
| | |
| | | */ |
| | | private List<String> enabledProtocols = new LinkedList<String>(); |
| | | |
| | | private TCPNIOTransport transport; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public LDAPOptions() |
| | | { |
| | | super(); |
| | | this.sslContext = null; |
| | | this.timeoutInMillis = 0; |
| | | this.useStartTLS = false; |
| | | this.decodeOptions = new DecodeOptions(); |
| | | this.transport = null; |
| | | } |
| | | |
| | | |
| | |
| | | this.decodeOptions = new DecodeOptions(options.decodeOptions); |
| | | this.enabledCipherSuites.addAll(options.getEnabledCipherSuites()); |
| | | this.enabledProtocols.addAll(options.getEnabledProtocols()); |
| | | this.transport = options.transport; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Returns the Grizzly TCP transport which will be used when initiating |
| | | * connections with the Directory Server. By default this method will return |
| | | * {@code null} indicating that the default transport factory should be used |
| | | * to obtain a TCP transport. |
| | | * |
| | | * @return The Grizzly TCP transport which will be used when initiating |
| | | * connections with the Directory Server, or {@code null} if the |
| | | * default transport factory should be used to obtain a TCP transport. |
| | | */ |
| | | public final TCPNIOTransport getTCPNIOTransport() |
| | | { |
| | | return transport; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns the operation timeout in the specified unit. |
| | | * |
| | | * @param unit |
| | |
| | | |
| | | |
| | | /** |
| | | * Sets the Grizzly TCP transport which will be used when initiating |
| | | * connections with the Directory Server. By default this method will return |
| | | * {@code null} indicating that the default transport factory will be used to |
| | | * obtain a TCP transport. |
| | | * |
| | | * @param transport |
| | | * The Grizzly TCP transport which will be used when initiating |
| | | * connections with the Directory Server, or {@code null} if the |
| | | * default transport factory should be used to obtain a TCP |
| | | * transport. |
| | | * @return A reference to this LDAP connection options. |
| | | */ |
| | | public final LDAPOptions setTCPNIOTransport(final TCPNIOTransport transport) |
| | | { |
| | | this.transport = transport; |
| | | return this; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Sets the operation timeout. If the response is not received from the |
| | | * Directory Server in the timeout period, the operation will be abandoned and |
| | | * an error result returned. A timeout setting of 0 disables timeout limits. |