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