Package lumis.portal.monitor
Class AbstractMonitorValuesProvider
- java.lang.Object
-
- lumis.portal.monitor.AbstractMonitorValuesProvider
-
- All Implemented Interfaces:
java.io.Serializable
,IMonitorValuesProvider
- Direct Known Subclasses:
ABTestMonitorValuesProvider
,GeoLocationValuesProvider
,OriginValueProvider
,ProjectIdMonitorValuesProvider
@StableMinor(version="17.0", sinceVersion="9.0") public abstract class AbstractMonitorValuesProvider extends java.lang.Object implements IMonitorValuesProvider
IMonitorValuesProvider
abstract implementation that provides both tread-safety and caching.
The monitoring values are internally stored as amap
. This map is filled byinitValues(SessionConfig, ITransaction)
method. This method is the one implementors should override.
It is important to notice thatinitValues(SessionConfig, ITransaction)
will be called only once. Once it has been called, the values will be cached and no further call will be performed.- Since:
- 9.0.0
- Version:
- $Revision$ $Date$
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractMonitorValuesProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<? extends java.io.Serializable>
getValues(SessionConfig sessionConfig, IMonitorField field, ITransaction transaction)
Returns the values for the given field.
If this value provider does not provide values for the given field, it must returnnull
.
Note that returning anull
value is not the same as returning an empty list.protected abstract java.util.Map<java.lang.String,java.util.List<? extends java.io.Serializable>>
initValues(SessionConfig sessionConfig, ITransaction transaction)
Initializes the monitoring values map.
-
-
-
Method Detail
-
getValues
public java.util.List<? extends java.io.Serializable> getValues(SessionConfig sessionConfig, IMonitorField field, ITransaction transaction) throws java.lang.Exception
Description copied from interface:IMonitorValuesProvider
Returns the values for the given field.
If this value provider does not provide values for the given field, it must returnnull
.
Note that returning anull
value is not the same as returning an empty list. When returning an empty list, it is implied that the field has an explicitnull
value. When anull
value is returned, then other value providers will be called. If a non-null
value is returned (even an empty list), then other value providers will not be called. Anynull
value or empty string in the returned list will be ignored, meaning that a list with onlynull
or empty strings will be considered an empty list.It is important to notice also that the given session config is not the session of the user that generated the monitoring event. Instead, it is a
system user
session.
As well as session config, the given transaction is not related to the transaction that generated the event (if any).- Specified by:
getValues
in interfaceIMonitorValuesProvider
- Parameters:
sessionConfig
- the current session.field
- the desired field.transaction
- the current transaction.- Returns:
- the values for the desired field.
- Throws:
java.lang.Exception
- if some error occur.
-
initValues
protected abstract java.util.Map<java.lang.String,java.util.List<? extends java.io.Serializable>> initValues(SessionConfig sessionConfig, ITransaction transaction) throws java.lang.Exception
Initializes the monitoring values map. This method will only be called once and the results will be cached. The implementations must not returnnull
. If no value is present, an empty map should be returned instead. Also, anynull
value in a list will be ignored, meaning that a list with onlynull
will be considered a empty list.- Parameters:
sessionConfig
- the session config.transaction
- the transaction.- Returns:
- the monitoring data map.
- Throws:
java.lang.Exception
- Since:
- 9.0.0
-
-