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.counter.service;
16  
17  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
18  import com.liferay.portal.kernel.exception.SystemException;
19  
20  import java.util.List;
21  
22  /**
23   * <a href="CounterServiceUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class CounterServiceUtil {
28  
29      public static List<String> getNames() throws SystemException {
30          return getService().getNames();
31      }
32  
33      public static CounterService getService() {
34          if (_service == null) {
35              _service = (CounterService)PortalBeanLocatorUtil.locate(
36                  CounterService.class.getName());
37          }
38  
39          return _service;
40      }
41  
42      public static long increment() throws SystemException {
43          return getService().increment();
44      }
45  
46      public static long increment(String name) throws SystemException {
47          return getService().increment(name);
48      }
49  
50      public static long increment(String name, int size) throws SystemException {
51          return getService().increment(name, size);
52      }
53  
54      public static void rename(String oldName, String newName)
55          throws SystemException {
56  
57          getService().rename(oldName, newName);
58      }
59  
60      public static void reset(String name) throws SystemException {
61          getService().reset(name);
62      }
63  
64      public static void reset(String name, long size)
65          throws SystemException {
66  
67          getService().reset(name, size);
68      }
69  
70      public void setService(CounterService service) {
71          _service = service;
72      }
73  
74      private static CounterService _service;
75  
76  }