1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }