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