1 /*
2 * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3 * the spring framework, http://el4j.sf.net
4 * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5 * 1000 Lausanne, Switzerland, http://www.elca.ch
6 *
7 * EL4J is published under the GNU Lesser General Public License (LGPL)
8 * Version 2.1. See http://www.gnu.org/licenses/
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * For alternative licensing, please contact info@elca.ch
16 */
17 package ch.elca.el4j.services.statistics.detailed.processing;
18
19 import java.util.List;
20
21 import ch.elca.el4j.services.statistics.detailed.MeasureItem;
22
23
24 /**
25 * Local service (both in container and in clients) allowing to collect measures
26 * in the system.
27 * <p>
28 * A measure is made of a collection of <code>MeasureItem</code> objects. A
29 * measure may be started by a client or on a server and sub-measures are then
30 * added by <code>MeasureInvoker</code>. <br>
31 * In order to group the diverse sub-measures of a same global measure, they are
32 * all identified by the same identifier. A sequence number is used to identify
33 * the order of the diverse sub-measures (starting at 1 for the global measure).
34 * <p>
35 * The id and sequence of the current measure (or sub-measures) are stored in
36 * the LEAF DetailedStatisticsSharedContextHolder object (keys defined by
37 * <code>CONTEXT_NAME_ID</code>
38 * and <code>CONTEXT_NAME_SEQ</code>).
39 * <p>
40 * So the <code>MeasureInvoker</code> (wherever it is) starts a measure if
41 * there is no defined <code>CONTEXT_NAME_ID</code> or it increases the
42 * sequence number to create a sub-measure.
43 *
44 * This class was ported from Leaf 2.
45 * Original authors: YMA,DBA.
46 * Leaf2 package name: ch.elca.leaf.services.measuring
47 *
48 * @svnLink $Revision: 3880 $;$Date: 2009-08-04 15:17:52 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/detailed_statistics/common/src/main/java/ch/elca/el4j/services/statistics/detailed/processing/MeasureCollectorService.java $
49 *
50 * @author Rashid Waraich (RWA)
51 *
52 * @see MeasureItem
53 * @see MeasureInterceptor
54 */
55 public interface MeasureCollectorService {
56
57 /**
58 * DetailedStatisticsSharedContextHolder key for saving the measure
59 * MeasureID object.
60 */
61 public static final String CONTEXT_NAME_ID = "MEASURE_ID";
62
63 /**
64 * DetailedStatisticsSharedContextHolder key for saving the
65 * measure sequence.
66 */
67 public static final String CONTEXT_NAME_SEQ = "MEASURE_SEQ";
68
69 /**
70 * Adds a new measure.
71 *
72 * @param item
73 * the measure to add
74 */
75 public void add(MeasureItem item);
76
77 /**
78 * Deletes all measures.
79 *
80 * @param amount
81 * Dummy paramater, not used for non persistant collector (will
82 * simply be ignored). Perhaps required later if other
83 * CollectorServices are also ported.
84 */
85 public void delete(int amount);
86
87 /**
88 * Returns a List of all the measures.
89 *
90 * @return the list of measures
91 */
92 public List<MeasureItem> getAllMeasureItems();
93
94 /**
95 * Inserts the locally stored measures in permanent storage.
96 */
97 public void writeMeasures();
98
99 /**
100 * @return The MeasureIds of the collected MeasureItems.
101 */
102 public List<MeasureItem> getFirstMeasureItems();
103 }