1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.portlet;
16  
17  import java.util.Map;
18  import java.util.concurrent.ConcurrentHashMap;
19  
20  /**
21   * <a href="PortletBagPool.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Brian Wing Shun Chan
24   */
25  public class PortletBagPool {
26  
27      public static PortletBag get(String portletId) {
28          return _instance._get(portletId);
29      }
30  
31      public static void put(String portletId, PortletBag portletBag) {
32          _instance._put(portletId, portletBag);
33      }
34  
35      public static PortletBag remove(String portletId) {
36          return _instance._remove(portletId);
37      }
38  
39      private PortletBagPool() {
40          _portletBagPool = new ConcurrentHashMap<String, PortletBag>();
41      }
42  
43      private PortletBag _get(String portletId) {
44          return _portletBagPool.get(portletId);
45      }
46  
47      private void _put(String portletId, PortletBag portletBag) {
48          _portletBagPool.put(portletId, portletBag);
49      }
50  
51      private PortletBag _remove(String portletId) {
52          return _portletBagPool.remove(portletId);
53      }
54  
55      private static PortletBagPool _instance = new PortletBagPool();
56  
57      private Map<String, PortletBag>_portletBagPool;
58  
59  }