001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.kernel.cache;
022:
023: import com.liferay.portal.kernel.bean.BeanLocatorUtil;
024:
025: import java.io.Serializable;
026:
027: /**
028: * <a href="SingleVMPoolUtil.java.html"><b><i>View Source</i></b></a>
029: *
030: * @author Brian Wing Shun Chan
031: * @author Michael Young
032: *
033: */
034: public class SingleVMPoolUtil {
035:
036: public static void clear() {
037: getSingleVMPool().clear();
038: }
039:
040: public static void clear(String name) {
041: getSingleVMPool().clear(name);
042: }
043:
044: public static Object get(String name, String key) {
045: return getSingleVMPool().get(name, key);
046: }
047:
048: public static Object get(PortalCache portalCache, String key) {
049: return getSingleVMPool().get(portalCache, key);
050: }
051:
052: public static PortalCache getCache(String name) {
053: return getSingleVMPool().getCache(name);
054: }
055:
056: public static SingleVMPool getSingleVMPool() {
057: return _getUtil()._singleVMPool;
058: }
059:
060: public static void put(String name, String key, Object obj) {
061: getSingleVMPool().put(name, key, obj);
062: }
063:
064: public static void put(PortalCache portalCache, String key,
065: Object obj) {
066: getSingleVMPool().put(portalCache, key, obj);
067: }
068:
069: public static void put(String name, String key, Serializable obj) {
070: getSingleVMPool().put(name, key, obj);
071: }
072:
073: public static void put(PortalCache portalCache, String key,
074: Serializable obj) {
075:
076: getSingleVMPool().put(portalCache, key, obj);
077: }
078:
079: public static void remove(String name, String key) {
080: getSingleVMPool().remove(name, key);
081: }
082:
083: public static void remove(PortalCache portalCache, String key) {
084: getSingleVMPool().remove(portalCache, key);
085: }
086:
087: public void setSingleVMPool(SingleVMPool singleVMPool) {
088: _singleVMPool = singleVMPool;
089: }
090:
091: private static SingleVMPoolUtil _getUtil() {
092: if (_util == null) {
093: _util = (SingleVMPoolUtil) BeanLocatorUtil.locate(_UTIL);
094: }
095:
096: return _util;
097: }
098:
099: private static final String _UTIL = SingleVMPoolUtil.class
100: .getName();
101:
102: private static SingleVMPoolUtil _util;
103:
104: private SingleVMPool _singleVMPool;
105:
106: }
|