org.rhq.enterprise.server.rest
Class MetricHandlerBean

java.lang.Object
  extended by org.rhq.enterprise.server.rest.AbstractRestBean
      extended by org.rhq.enterprise.server.rest.MetricHandlerBean
All Implemented Interfaces:
MetricHandlerLocal

public class MetricHandlerBean
extends AbstractRestBean
implements MetricHandlerLocal

Deal with metrics

Author:
Heiko W. Rupp

Constructor Summary
MetricHandlerBean()
           
 
Method Summary
 List<MetricAggregate> getAggregatesForResource(int resourceId)
           
 Baseline getBaseline(int scheduleId, javax.ws.rs.core.HttpHeaders headers, javax.ws.rs.core.UriInfo uriInfo)
           
 javax.ws.rs.core.Response getMetricData(int scheduleId, long startTime, long endTime, int dataPoints, boolean hideEmpty, javax.ws.rs.core.Request request, javax.ws.rs.core.HttpHeaders headers)
           
 javax.ws.rs.core.Response getMetricDataMulti(String schedules, long startTime, long endTime, int dataPoints, boolean hideEmpty, javax.ws.rs.core.Request request, javax.ws.rs.core.HttpHeaders headers)
           
 javax.ws.rs.core.StreamingOutput getMetricDataRaw(int scheduleId, long startTime, long endTime, long duration, javax.ws.rs.core.Request request, javax.ws.rs.core.HttpHeaders headers)
          Expose the raw metrics for the given schedule
 javax.ws.rs.core.Response getSchedule(int scheduleId, javax.ws.rs.core.Request request, javax.ws.rs.core.HttpHeaders headers, javax.ws.rs.core.UriInfo uriInfo)
          Return a metric schedule with the respective status codes for cache validation
 javax.ws.rs.core.Response getTraitValue(int scheduleId)
           
 javax.ws.rs.core.Response postMetricValues(Collection<NumericDataPoint> points, javax.ws.rs.core.HttpHeaders headers)
          Submit a series of (numerical) metric values to the server
 javax.ws.rs.core.Response putMetricValue(int scheduleId, long timestamp, NumericDataPoint point, javax.ws.rs.core.HttpHeaders headers, javax.ws.rs.core.UriInfo uriInfo)
          Submit a single (numerical) metric value to the server.
 javax.ws.rs.core.Response putTraitValue(int scheduleId, StringValue value)
           
 void setBaseline(int scheduleId, Baseline baseline, javax.ws.rs.core.HttpHeaders headers, javax.ws.rs.core.UriInfo uriInfo)
           
 javax.ws.rs.core.Response updateSchedule(int scheduleId, MetricSchedule in, javax.ws.rs.core.HttpHeaders httpHeaders)
          Update a schedule.
 
Methods inherited from class org.rhq.enterprise.server.rest.AbstractRestBean
fillRWT, getFqn, getFromCache, getFromCache, getResourceFromCache, getResourcesFromCacheByParentId, putResourceToCache, putToCache, putToCache, removeFromCache, renderTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricHandlerBean

public MetricHandlerBean()
Method Detail

getMetricData

public javax.ws.rs.core.Response getMetricData(int scheduleId,
                                               long startTime,
                                               long endTime,
                                               int dataPoints,
                                               boolean hideEmpty,
                                               @Context
                                               javax.ws.rs.core.Request request,
                                               @Context
                                               javax.ws.rs.core.HttpHeaders headers)
Specified by:
getMetricData in interface MetricHandlerLocal

getMetricDataMulti

public javax.ws.rs.core.Response getMetricDataMulti(String schedules,
                                                    long startTime,
                                                    long endTime,
                                                    int dataPoints,
                                                    boolean hideEmpty,
                                                    @Context
                                                    javax.ws.rs.core.Request request,
                                                    @Context
                                                    javax.ws.rs.core.HttpHeaders headers)
Specified by:
getMetricDataMulti in interface MetricHandlerLocal

getSchedule

public javax.ws.rs.core.Response getSchedule(int scheduleId,
                                             javax.ws.rs.core.Request request,
                                             javax.ws.rs.core.HttpHeaders headers,
                                             javax.ws.rs.core.UriInfo uriInfo)
Return a metric schedule with the respective status codes for cache validation

Specified by:
getSchedule in interface MetricHandlerLocal
Parameters:
scheduleId - ID of the schedule
request - the REST request - injected by the REST framework
headers - the REST request http headers - injected by the REST framework
uriInfo - info about the called uri to build links
Returns:
Schedule with respective headers

getAggregatesForResource

public List<MetricAggregate> getAggregatesForResource(int resourceId)
Specified by:
getAggregatesForResource in interface MetricHandlerLocal

updateSchedule

public javax.ws.rs.core.Response updateSchedule(int scheduleId,
                                                MetricSchedule in,
                                                javax.ws.rs.core.HttpHeaders httpHeaders)
Description copied from interface: MetricHandlerLocal
Update a schedule. Currently change of collection interval and enabled/disabled state are supported.

Specified by:
updateSchedule in interface MetricHandlerLocal
Parameters:
scheduleId - Id of the schedule to update
in - Modified schedule object
httpHeaders - Injected http headers
Returns:
Result of updating

getMetricDataRaw

public javax.ws.rs.core.StreamingOutput getMetricDataRaw(int scheduleId,
                                                         long startTime,
                                                         long endTime,
                                                         long duration,
                                                         javax.ws.rs.core.Request request,
                                                         javax.ws.rs.core.HttpHeaders headers)
Description copied from interface: MetricHandlerLocal
Expose the raw metrics for the given schedule

Specified by:
getMetricDataRaw in interface MetricHandlerLocal
Parameters:
scheduleId - Schedule id
startTime - Start time, if 0 and duration=, start time = 8h before endTime
endTime - End time. If 0, now is used
duration - Duration in seconds. If duration=0, startTime is used
request - Injected Request headers
headers - Injected HttpHeaders
Returns:
a JSON encoded stream of numerical values

putMetricValue

public javax.ws.rs.core.Response putMetricValue(int scheduleId,
                                                long timestamp,
                                                NumericDataPoint point,
                                                @Context
                                                javax.ws.rs.core.HttpHeaders headers,
                                                javax.ws.rs.core.UriInfo uriInfo)
Description copied from interface: MetricHandlerLocal
Submit a single (numerical) metric value to the server.

Specified by:
putMetricValue in interface MetricHandlerLocal
Parameters:
scheduleId - Id of the schedule to submit to
timestamp - Timestamp of the entry
point - Datapoint of class NumericDataPoint
headers - Injected HTTP headers
uriInfo - Injected info about the uri
Returns:

putTraitValue

public javax.ws.rs.core.Response putTraitValue(int scheduleId,
                                               StringValue value)
Specified by:
putTraitValue in interface MetricHandlerLocal

getTraitValue

public javax.ws.rs.core.Response getTraitValue(int scheduleId)
Specified by:
getTraitValue in interface MetricHandlerLocal

postMetricValues

public javax.ws.rs.core.Response postMetricValues(Collection<NumericDataPoint> points,
                                                  @Context
                                                  javax.ws.rs.core.HttpHeaders headers)
Description copied from interface: MetricHandlerLocal
Submit a series of (numerical) metric values to the server

Specified by:
postMetricValues in interface MetricHandlerLocal
Parameters:
points - Collection of NumericDataPoint entries
headers - Injected HTTP headers
Returns:
response object

getBaseline

public Baseline getBaseline(int scheduleId,
                            @Context
                            javax.ws.rs.core.HttpHeaders headers,
                            @Context
                            javax.ws.rs.core.UriInfo uriInfo)
Specified by:
getBaseline in interface MetricHandlerLocal

setBaseline

public void setBaseline(int scheduleId,
                        Baseline baseline,
                        javax.ws.rs.core.HttpHeaders headers,
                        @Context
                        javax.ws.rs.core.UriInfo uriInfo)
Specified by:
setBaseline in interface MetricHandlerLocal


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.