View Javadoc

1   /*
2    * Copyright 2010 University Corporation for Advanced Internet Development, Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector;
18  
19  import edu.vt.middleware.ldap.Ldap;
20  import edu.vt.middleware.ldap.pool.LdapFactory;
21  import edu.vt.middleware.ldap.pool.LdapPoolConfig;
22  
23  /**
24   * Used by the ldap data connector to interface with various pooling implementations. 
25   */
26  public interface LdapPoolStrategy {
27  
28      /**
29       * Sets the ldap factory.
30       *
31       * @param  factory  to create ldap objects with
32       */
33      void setLdapFactory(LdapFactory<Ldap> factory);
34  
35      /**
36       * Sets the ldap pool configuration.
37       *
38       * @param  config  to manage ldap pool with
39       */
40      void setLdapPoolConfig(LdapPoolConfig config);
41  
42      /**
43       * Sets whether to block when the pool is empty.
44       *
45       * @param  block  when the pool is empty
46       */
47      void setBlockWhenEmpty(boolean block);
48  
49      /**
50       * Prepare the pool for use.
51       */
52      void initialize();
53  
54      /**
55       * Retrieve an ldap object.
56       * 
57       * @return  ldap object
58       * @throws Exception
59       */
60      Ldap checkOut() throws Exception;
61  
62      /**
63       * Return an ldap object.
64       *
65       * @param l
66       */
67      void checkIn(Ldap l) throws Exception;
68  }