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   * Ldap pool strategy that does no pooling. 
25   */
26  public class LdapPoolEmptyStrategy implements LdapPoolStrategy {
27  
28      /** Factory for making ldap objects. */
29      private LdapFactory<Ldap> ldapFactory;
30  
31      /**
32       * Default constructor.
33       */
34      public LdapPoolEmptyStrategy() {}
35  
36      /** {@inheritDoc} */
37      public void setLdapPoolConfig(LdapPoolConfig config) {}
38  
39      /** {@inheritDoc} */
40      public void setLdapFactory(LdapFactory<Ldap> factory) {
41          ldapFactory = factory;
42      }
43  
44      /** {@inheritDoc} */
45      public void setBlockWhenEmpty(boolean block) {}
46  
47      /** {@inheritDoc} */
48      public void initialize() {}
49  
50      /** {@inheritDoc} */
51      public Ldap checkOut() throws Exception {
52          return ldapFactory.create();
53      }
54  
55      /** {@inheritDoc} */
56      public void checkIn(Ldap l) throws Exception {
57          ldapFactory.destroy(l);
58      }
59  }