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.persistence;
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="CounterUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class CounterUtil {
28  
29      public static List<String> getNames() throws SystemException {
30          return getPersistence().getNames();
31      }
32  
33      public static CounterPersistence getPersistence() {
34          if (_persistence == null) {
35              _persistence = (CounterPersistence)PortalBeanLocatorUtil.locate(
36                  CounterPersistence.class.getName());
37          }
38  
39          return _persistence;
40      }
41  
42      public static long increment() throws SystemException {
43          return getPersistence().increment();
44      }
45  
46      public static long increment(String name) throws SystemException {
47          return getPersistence().increment(name);
48      }
49  
50      public static long increment(String name, int size)
51          throws SystemException {
52  
53          return getPersistence().increment(name, size);
54      }
55  
56      public static void rename(String oldName, String newName)
57          throws SystemException {
58  
59          getPersistence().rename(oldName, newName);
60      }
61  
62      public static void reset(String name) throws SystemException {
63          getPersistence().reset(name);
64      }
65  
66      public static void reset(String name, long size) throws SystemException {
67          getPersistence().reset(name, size);
68      }
69  
70      public void setPersistence(CounterPersistence persistence) {
71          _persistence = persistence;
72      }
73  
74      private static CounterPersistence _persistence;
75  
76  }