001 /*
002 * Copyright 2009-2013 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2009-2013 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.sdk.migrate.ldapjdk;
022
023
024
025 import java.net.Socket;
026
027 import com.unboundid.util.Extensible;
028 import com.unboundid.util.ThreadSafety;
029 import com.unboundid.util.ThreadSafetyLevel;
030
031
032
033 /**
034 * This interface defines a method that can be used to construct the socket to
035 * use when communicating with the directory server.
036 * <BR><BR>
037 * This class is primarily intended to be used in the process of updating
038 * applications which use the Netscape Directory SDK for Java to switch to or
039 * coexist with the UnboundID LDAP SDK for Java. For applications not written
040 * using the Netscape Directory SDK for Java, the standard Java socket factory
041 * may be used directly without the need for the {@code LDAPSocketFactory}
042 * interface.
043 */
044 @Extensible()
045 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
046 public interface LDAPSocketFactory
047 {
048 /**
049 * Creates a socket to use when connecting to the directory sever.
050 *
051 * @param host The address of the server to which the socket should be
052 * connected.
053 * @param port The port of the server to which the socket should be
054 * connected.
055 *
056 * @return The connected socket to use to communicate with the directory
057 * server.
058 *
059 * @throws LDAPException If a problem occurs while establishing the
060 * connection.
061 */
062 Socket makeSocket(final String host, final int port)
063 throws LDAPException;
064 }