1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.cache;
24  
25  import com.liferay.portal.kernel.bean.BeanLocatorUtil;
26  
27  import java.io.Serializable;
28  
29  import java.util.Map;
30  import java.util.Set;
31  
32  /**
33   * <a href="MultiVMPoolUtil.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   * @author Michael Young
37   *
38   */
39  public class MultiVMPoolUtil {
40  
41      public static void clear() {
42          getMultiVMPool().clear();
43      }
44  
45      public static void clear(String name) {
46          getMultiVMPool().clear(name);
47      }
48  
49      public static void clearGroup(
50          Map<String, Set<String>> groups, String groupKey,
51          PortalCache portalCache) {
52  
53          getMultiVMPool().clearGroup(groups, groupKey, portalCache);
54      }
55  
56      public static Object get(String name, String key) {
57          return getMultiVMPool().get(name, key);
58      }
59  
60      public static Object get(PortalCache portalCache, String key) {
61          return getMultiVMPool().get(portalCache, key);
62      }
63  
64      public static MultiVMPool getMultiVMPool() {
65          return _getUtil()._multiVMPool;
66      }
67  
68      public static PortalCache getCache(String name) {
69          return getMultiVMPool().getCache(name);
70      }
71  
72      public static void put(String name, String key, Object obj) {
73          getMultiVMPool().put(name, key, obj);
74      }
75  
76      public static void put(PortalCache portalCache, String key, Object obj) {
77          getMultiVMPool().put(portalCache, key, obj);
78      }
79  
80      public static void put(
81          PortalCache portalCache, String key, Map<String, Set<String>> groups,
82          String groupKey, Object obj) {
83  
84          getMultiVMPool().put(portalCache, key, groups, groupKey, obj);
85      }
86  
87      public static void put(String name, String key, Serializable obj) {
88          getMultiVMPool().put(name, key, obj);
89      }
90  
91      public static void put(
92          PortalCache portalCache, String key, Serializable obj) {
93  
94          getMultiVMPool().put(portalCache, key, obj);
95      }
96  
97      public static void put(
98          PortalCache portalCache, String key, Map<String, Set<String>> groups,
99          String groupKey, Serializable obj) {
100 
101         getMultiVMPool().put(portalCache, key, groups, groupKey, obj);
102     }
103 
104     public static void remove(String name, String key) {
105         getMultiVMPool().remove(name, key);
106     }
107 
108     public static void remove(PortalCache portalCache, String key) {
109         getMultiVMPool().remove(portalCache, key);
110     }
111 
112     public static void updateGroup(
113         Map<String, Set<String>> groups, String groupKey, String key) {
114 
115         getMultiVMPool().updateGroup(groups, groupKey, key);
116     }
117 
118     public void setMultiVMPool(MultiVMPool multiVMPool) {
119         _multiVMPool = multiVMPool;
120     }
121 
122     private static MultiVMPoolUtil _getUtil() {
123         if (_util == null) {
124             _util = (MultiVMPoolUtil)BeanLocatorUtil.locate(_UTIL);
125         }
126 
127         return _util;
128     }
129 
130     private static final String _UTIL = MultiVMPoolUtil.class.getName();
131 
132     private static MultiVMPoolUtil _util;
133 
134     private MultiVMPool _multiVMPool;
135 
136 }