1 | /* |
2 | * Copyright 2005-2006 The RbUtils Project |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | * |
16 | */ |
17 | |
18 | // $Id: EventCounter.java,v 1.1 2007/07/08 01:07:59 moishi Exp $ |
19 | |
20 | package org.ktc.rbutils.api.audit; |
21 | |
22 | import org.ktc.rbutils.api.audit.event.ProcessStartEvent; |
23 | |
24 | /** |
25 | * A logger that keeps track of the number of Events it recieves. |
26 | * @since RbUtils 0.11 |
27 | * @version $Revision: 1.1 $ |
28 | * @author moishi |
29 | */ |
30 | public class EventCounter extends LoggerHelper { |
31 | |
32 | /** Keeps track of the number of counted events. */ |
33 | //TODO Code - does this need to be synchronized ? |
34 | protected int count; |
35 | |
36 | /** Create a new errors counter. */ |
37 | public EventCounter() { |
38 | // Do Nothing |
39 | } |
40 | |
41 | /** {@inheritDoc} */ |
42 | public void processStarted(final ProcessStartEvent event) { |
43 | count = 0; |
44 | } |
45 | |
46 | /** |
47 | * Returns the number of counted events since the process started. |
48 | * @return the number of counted events since process started. |
49 | */ |
50 | public int getCount() { |
51 | return count; |
52 | } |
53 | } |