View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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  package org.kuali.rice.core.api.cache;
17  
18  import org.springframework.cache.CacheManager;
19  
20  import java.util.List;
21  
22  /**
23   * Allows access to a registry of {@link CacheManager} instances that are identified by name.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   * @since 2.0
27   */
28  public interface CacheManagerRegistry {
29      
30      /**
31       * Will return a list of registered cache managers.  Will not return null but may return an empty list.
32       * 
33       * @return a list of cache managers
34       */
35      List<CacheManager> getCacheManagers();
36  
37      /**
38       * Gets a cache manager for a given name.  Name cannot be null or blank.
39       *
40       * @param name the cache manager name
41       * @return the CacheManager
42       * @throws IllegalArgumentException if the name is null or blank
43       */
44      CacheManager getCacheManager(String name);
45  
46      /**
47       * Gets the name of a cache manager.  The cm cannot be null.  Will not return null or blank string.
48       *
49       * @param cm the cache manager
50       * @return the name
51       * @throws IllegalArgumentException if the cm is null
52       */
53      String getCacheManagerName(CacheManager cm);
54  
55      /**
56       * Gets a cache manager for a given cache name.  Name cannot be null or blank.
57       *
58       * @param cacheName the  name of a Cache in a CacheManager.
59       * @return the CacheManager
60       * @throws IllegalArgumentException if the name is null or blank
61       */
62      CacheManager getCacheManagerByCacheName(String cacheName);
63  }