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 legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2008 Sun Microsystems, Inc.
025 */
026
027package org.opends.server.protocols.internal;
028
029
030
031import java.net.Socket;
032
033import netscape.ldap.LDAPSocketFactory;
034
035
036
037/**
038 * This class provides an implementation of the
039 * {{netscape.ldap.LDAPSocketFactory}} class that can be used to allow
040 * the Mozilla LDAP SDK for Java to perform internal operations in
041 * OpenDS.  To use it, simply provide an instance of this class to the
042 * constructor of the {{netscape.ldap.LDAPConnection}} class, like:
043 * <PRE>
044 * LDAPConnection conn =
045 *      new LDAPConnection(new InternalMozillaLDAPSocketFactory());
046 * </PRE>
047 */
048public final class InternalMozillaLDAPSocketFactory
049       implements LDAPSocketFactory
050{
051  /**
052   * Creates a new instance of this internal Mozilla LDAP socket
053   * factory.
054   */
055  public InternalMozillaLDAPSocketFactory()
056  {
057    // No implementation is required.
058  }
059
060
061
062  /**
063   * Creates and returns a new internal LDAP socket, which can be used
064   * by the Mozilla LDAP SDK for Java to perform internal operations
065   * in OpenDS.
066   *
067   * @param  host  The address of the server to which the connection
068   *               should be established.  This will be ignored, since
069   *               there will not be any actual network communication.
070   * @param  port  The port of the server to which the connection
071   *               should be established.  This will be ignored, since
072   *               there will not be any actual network communication.
073   *
074   * @return  An internal LDAP socket, which can be used by the
075   *          Mozilla LDAP SDK for Java to perform internal operations
076   *          in OpenDS.
077   */
078  public Socket makeSocket(String host, int port)
079  {
080    return new InternalLDAPSocket();
081  }
082}
083