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 * trunk/opends/resource/legal-notices/OpenDS.LICENSE 011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE. 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 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2008 Sun Microsystems, Inc. 026 */ 027 028 package org.opends.server.protocols.internal; 029 030 031 032 import java.net.Socket; 033 034 import netscape.ldap.LDAPSocketFactory; 035 036 037 038 /** 039 * This class provides an implementation of the 040 * {{netscape.ldap.LDAPSocketFactory}} class that can be used to allow 041 * the Mozilla LDAP SDK for Java to perform internal operations in 042 * OpenDS. To use it, simply provide an instance of this class to the 043 * constructor of the {{netscape.ldap.LDAPConnection}} class, like: 044 * <PRE> 045 * LDAPConnection conn = 046 * new LDAPConnection(new InternalMozillaLDAPSocketFactory()); 047 * </PRE> 048 */ 049 public final class InternalMozillaLDAPSocketFactory 050 implements LDAPSocketFactory 051 { 052 /** 053 * Creates a new instance of this internal Mozilla LDAP socket 054 * factory. 055 */ 056 public InternalMozillaLDAPSocketFactory() 057 { 058 // No implementation is required. 059 } 060 061 062 063 /** 064 * Creates and returns a new internal LDAP socket, which can be used 065 * by the Mozilla LDAP SDK for Java to perform internal operations 066 * in OpenDS. 067 * 068 * @param host The address of the server to which the connection 069 * should be established. This will be ignored, since 070 * there will not be any actual network communication. 071 * @param port The port of the server to which the connection 072 * should be established. This will be ignored, since 073 * there will not be any actual network communication. 074 * 075 * @return An internal LDAP socket, which can be used by the 076 * Mozilla LDAP SDK for Java to perform internal operations 077 * in OpenDS. 078 */ 079 public Socket makeSocket(String host, int port) 080 { 081 return new InternalLDAPSocket(); 082 } 083 } 084