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.portlet;
16  
17  import java.util.Map;
18  import java.util.concurrent.ConcurrentHashMap;
19  
20  /**
21   * <a href="PortletContextBagPool.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Brian Wing Shun Chan
24   */
25  public class PortletContextBagPool {
26  
27      public static PortletContextBag get(String servletContextName) {
28          return _instance._get(servletContextName);
29      }
30  
31      public static void put(
32          String servletContextName, PortletContextBag portletContextBag) {
33  
34          _instance._put(servletContextName, portletContextBag);
35      }
36  
37      public static PortletContextBag remove(String servletContextName) {
38          return _instance._remove(servletContextName);
39      }
40  
41      private PortletContextBagPool() {
42          _portletContextBagPool =
43              new ConcurrentHashMap<String, PortletContextBag>();
44      }
45  
46      private PortletContextBag _get(String servletContextName) {
47          return _portletContextBagPool.get(servletContextName);
48      }
49  
50      private void _put(
51          String servletContextName, PortletContextBag portletContextBag) {
52  
53          _portletContextBagPool.put(servletContextName, portletContextBag);
54      }
55  
56      private PortletContextBag _remove(String servletContextName) {
57          return _portletContextBagPool.remove(servletContextName);
58      }
59  
60      private static PortletContextBagPool _instance =
61          new PortletContextBagPool();
62  
63      private Map<String, PortletContextBag>_portletContextBagPool;
64  
65  }