View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  /**
24   * 
25   */
26  package com.gisgraphy.service;
27  
28  import com.gisgraphy.stats.StatsUsage;
29  import com.gisgraphy.stats.StatsUsageType;
30  
31  /**
32   * Manage The {@link StatsUsage}
33   * 
34   * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
35   * 
36   */
37  public interface IStatsUsageService {
38  
39      /**
40       * The satsUsage will be flush into the database every ... It is recommended
41       * to increase this value to a higher value to improve performances. if the
42       * server is stopped, you can loose FLUSH_THRESHOLD usage at most because the
43       * value won't be persist in the datastore
44       */
45      int FLUSH_THRESHOLD = 50;
46  
47      /**
48       * @return the number of counter that are managed
49       */
50      int getNumberOfCounter();
51  
52      /**
53       * @param statsUsageType
54       *                the usagetype
55       * @return the Usage for the specified {@link StatsUsageType}
56       */
57      Long getUsage(StatsUsageType statsUsageType);
58  
59      /**
60       * @param statsUsageType
61       *                the {@link StatsUsageType} counter to increase Increase
62       *                the counter of the specified type
63       */
64      void increaseUsage(StatsUsageType statsUsageType);
65  
66      /**
67       * @param statsUsageType
68       *                the {@link StatsUsageType} to reset reset the stats for
69       *                the specified {@link StatsUsageType}
70       */
71      void resetUsage(StatsUsageType statsUsageType);
72  
73      /**
74       * @param statsUsageType
75       *                the {@link StatsUsageType} to flush flush the value into
76       *                database
77       */
78      void flush(StatsUsageType statsUsageType);
79  
80  }