Class AbstractSampleManager
- java.lang.Object
-
- org.ametys.runtime.plugins.admin.jvmstatus.monitoring.sample.AbstractSampleManager
-
- All Implemented Interfaces:
PluginAware
,MonitoringConstants
,SampleManager
,Configurable
,LogEnabled
,ThreadSafe
- Direct Known Subclasses:
AbstractAlertSampleManager
,AbstractMemorySampleManager
,CacheSampleManager
,CPUSampleManager
,HttpRequestSampleManager
,HttpSessionSampleManager
,SessionSampleManager
,UptimeSampleManager
public abstract class AbstractSampleManager extends Object implements SampleManager, MonitoringConstants, ThreadSafe, LogEnabled, Configurable, PluginAware
AbstractSampleManager gives you the infrastructure for easily deploying aSampleManager
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.runtime.plugins.admin.jvmstatus.monitoring.MonitoringConstants
MonitoringConstants.Period
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nizableText
_description
descriptionprotected String
_featureName
The name of the feature that has declared this componentprotected String
_id
idprotected I18nizableText
_label
labelprotected Logger
_logger
Logger available to subclasses.protected String
_pluginName
The name of the plugin that has declared this component-
Fields inherited from interface org.ametys.runtime.plugins.admin.jvmstatus.monitoring.MonitoringConstants
FEEDING_PERIOD, RRD_EXT, RRD_STORAGE_DIRECTORY
-
-
Constructor Summary
Constructors Constructor Description AbstractSampleManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
_configureDatasources(org.rrd4j.core.RrdDef rrdDef)
Provides the data sources.protected void
_configureValueRange(org.rrd4j.graph.RrdGraphDef graphDef)
Configure the value range to be displayed.
Default implementation set min value to0
.protected abstract String
_getGraphTitle()
Provide the graph title.protected abstract Map<String,Object>
_internalCollect(org.rrd4j.core.Sample sample)
Collect data into the Round Robin Database.protected void
_registerDatasources(org.rrd4j.core.RrdDef rrdDef, String dsName, org.rrd4j.DsType dsType, double minValue, double maxValue)
Register a new data source where heartbeat property is set internally.protected void
_setCommonParameters(org.rrd4j.graph.RrdGraphDef graphDef)
Set common graph definition parameters (graph style, ...)Map<String,Object>
collect(org.rrd4j.core.Sample sample)
Collect data into the Round Robin Database.void
configure(Configuration configuration)
void
configureRRDDef(org.rrd4j.core.RrdDef rrdDef)
Provides the definition to use for this RRD file.void
enableLogging(Logger logger)
I18nizableText
getDescription()
Provides the human readable description.String
getId()
Provides the id of this manager.
Must be unique in the application.I18nizableText
getLabel()
Provides the human readable name to use.void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The name of the plugin that has declared this component
-
_featureName
protected String _featureName
The name of the feature that has declared this component
-
_label
protected I18nizableText _label
label
-
_description
protected I18nizableText _description
description
-
-
Constructor Detail
-
AbstractSampleManager
public AbstractSampleManager()
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:SampleManager
Provides the id of this manager.
Must be unique in the application.- Specified by:
getId
in interfaceSampleManager
- Returns:
- the id.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:SampleManager
Provides the human readable name to use.- Specified by:
getLabel
in interfaceSampleManager
- Returns:
- the human readable name.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:SampleManager
Provides the human readable description.- Specified by:
getDescription
in interfaceSampleManager
- Returns:
- the human readable description.
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLogging
in interfaceLogEnabled
-
configureRRDDef
public void configureRRDDef(org.rrd4j.core.RrdDef rrdDef)
Description copied from interface:SampleManager
Provides the definition to use for this RRD file. Called only when the RRD file is about to be created.- Specified by:
configureRRDDef
in interfaceSampleManager
- Parameters:
rrdDef
- the Round Robin Database definition.
-
_configureDatasources
protected abstract void _configureDatasources(org.rrd4j.core.RrdDef rrdDef)
Provides the data sources.- Parameters:
rrdDef
- the Round Robin Database definition.
-
_registerDatasources
protected void _registerDatasources(org.rrd4j.core.RrdDef rrdDef, String dsName, org.rrd4j.DsType dsType, double minValue, double maxValue)
Register a new data source where heartbeat property is set internally.- Parameters:
rrdDef
- the Round Robin Database definition.dsName
- the data source name.dsType
- the data source type.minValue
- the minimal acceptable value. UseDouble.NaN
if unknown.maxValue
- the maximal acceptable value. UseDouble.NaN
if unknown.
-
collect
public Map<String,Object> collect(org.rrd4j.core.Sample sample) throws IOException
Description copied from interface:SampleManager
Collect data into the Round Robin Database.- Specified by:
collect
in interfaceSampleManager
- Parameters:
sample
- the sample to collect.- Returns:
- The collected values for each datasource name.
- Throws:
IOException
- thrown in case of I/O error.
-
_internalCollect
protected abstract Map<String,Object> _internalCollect(org.rrd4j.core.Sample sample) throws IOException
Collect data into the Round Robin Database.- Parameters:
sample
- the sample to collect.- Returns:
- The collected values for each datasource name.
- Throws:
IOException
- thrown in case of I/O error.
-
_setCommonParameters
protected void _setCommonParameters(org.rrd4j.graph.RrdGraphDef graphDef)
Set common graph definition parameters (graph style, ...)- Parameters:
graphDef
- the prepared graph definition.
-
_configureValueRange
protected void _configureValueRange(org.rrd4j.graph.RrdGraphDef graphDef)
Configure the value range to be displayed.
Default implementation set min value to0
.- Parameters:
graphDef
- the graph definition.
-
_getGraphTitle
protected abstract String _getGraphTitle()
Provide the graph title.- Returns:
- the graph title.
-
-