Package org.onosproject.ui.chart
Class ChartRequestHandler
- java.lang.Object
-
- org.onosproject.ui.RequestHandler
-
- org.onosproject.ui.chart.ChartRequestHandler
-
public abstract class ChartRequestHandler extends RequestHandler
Message handler specifically for the chart views.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
LABEL
-
Fields inherited from class org.onosproject.ui.RequestHandler
MAPPER
-
-
Constructor Summary
Constructors Constructor Description ChartRequestHandler(String reqType, String respType, String nodeName)
Constructs a chart model handler for a specific graph view.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ChartModel
createChartModel()
Creates the chart model usinggetSeries()
to initialize it, ready to be populated.protected abstract String[]
getSeries()
Subclasses should return the array of series with which to initialize their chart model.protected abstract void
populateChart(ChartModel cm, com.fasterxml.jackson.databind.node.ObjectNode payload)
Subclasses should populate the chart model by addingdatapoints
.void
process(com.fasterxml.jackson.databind.node.ObjectNode payload)
Processes the incoming message payload from the client.-
Methods inherited from class org.onosproject.ui.RequestHandler
bool, chain, eventType, get, number, sendMessage, sendMessage, string, string
-
-
-
-
Field Detail
-
LABEL
protected static final String LABEL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChartRequestHandler
public ChartRequestHandler(String reqType, String respType, String nodeName)
Constructs a chart model handler for a specific graph view. When chart requests come in, the handler will generate the appropriate chart data points and send back the response to the client.- Parameters:
reqType
- type of the request eventrespType
- type of the response eventnodeName
- name of JSON node holding data point
-
-
Method Detail
-
process
public void process(com.fasterxml.jackson.databind.node.ObjectNode payload)
Description copied from class:RequestHandler
Processes the incoming message payload from the client.- Specified by:
process
in classRequestHandler
- Parameters:
payload
- request message payload
-
createChartModel
protected ChartModel createChartModel()
Creates the chart model usinggetSeries()
to initialize it, ready to be populated.This default implementation returns a chart model for all series.
- Returns:
- an empty chart model
-
getSeries
protected abstract String[] getSeries()
Subclasses should return the array of series with which to initialize their chart model.- Returns:
- the series name
-
populateChart
protected abstract void populateChart(ChartModel cm, com.fasterxml.jackson.databind.node.ObjectNode payload)
Subclasses should populate the chart model by addingdatapoints
.cm.addDataPoint() .data(SERIES_ONE, ...) .data(SERIES_TWO, ...) ... ;
The request payload is provided in case there are request filtering parameters.- Parameters:
cm
- the chart modelpayload
- request payload
-
-