1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 21 package org.apache.directory.ldap.client.api; 22 23 24 25 26 /** 27 * A factory for creating LdapConnection objects managed by LdapConnectionPool. The connections are 28 * not validated when they are pulled from the pool : we just check if they are still connected, using 29 * their internal flag. We don't either re-bind when we push back teh connection into the pool. 30 * <br/> 31 * It's up to the users to be careful with the way they deal with connectiosn -especially when using 32 * the StartTLS extended operation -. 33 * 34 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 35 */ 36 public class DefaultPoolableLdapConnectionFactory extends AbstractPoolableLdapConnectionFactory 37 { 38 /** 39 * Creates a new instance of PoolableLdapConnectionFactory. 40 * 41 * @param config the configuration for creating LdapConnections 42 */ 43 public DefaultPoolableLdapConnectionFactory( LdapConnectionConfig config ) 44 { 45 this( new DefaultLdapConnectionFactory( config ) ); 46 } 47 48 49 /** 50 * Creates a new instance of PoolableLdapConnectionFactory using an instance 51 * of the supplied class as its LdapConnection factory. 52 * 53 * @param config the configuration for creating LdapConnections 54 * @param connectionFactoryClass the class used as a factory for connections 55 */ 56 public DefaultPoolableLdapConnectionFactory( LdapConnectionConfig config, 57 Class<? extends LdapConnectionFactory> connectionFactoryClass ) 58 { 59 this( newLdapConnectionFactory( config, connectionFactoryClass ) ); 60 } 61 62 63 /** 64 * Creates a new instance of PoolableLdapConnectionFactory. 65 * 66 * @param connectionFactory the connection factory for creating LdapConnections 67 */ 68 public DefaultPoolableLdapConnectionFactory( LdapConnectionFactory connectionFactory ) 69 { 70 this.connectionFactory = connectionFactory; 71 } 72 }