uk.ac.soton.itinnovation.grid.service.sla.bizfacade
Interface UsageReportFacade

All Known Implementing Classes:
UsageReportFacadeImpl

public interface UsageReportFacade


Method Summary
 void addUsageReport(UsageReport report)
          Process a usage report.
 void addUsageReports(List<UsageReport> reports)
          Process batch of usage reports.
 List<Metric> getMetricsForResource(Long resourceEntityId)
          Get a list of all Metrics used by the ResourceWithUsageByMetric identified by resourceEntityId.
 double getRate(Long resourceEntityId, Metric metric, long instant)
          Calculate the rate at an instant in time for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and at the given instant.
 double getTotalPositiveRateChange(Long resourceEntityId, Metric metric, long startInstant, long endInstant)
          Aggregate all positive rate changes between startInstant and endInstant for the ResourceWithUsageByMetric entity identified by resourceEntityId and for a particular metric.
 double getUsage(Long resourceEntityId, Metric metric, long instant)
          Calculate the usage at an instant in time for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and at the given instant.
 List<UsageSummaryElement> getUsageElements(Long resourceEntityId, Metric metric, long start, long end)
          Get a list of UsageSummaryElements that represent a summary of usage for a metric on a particular resource.
 double getUsageInPeriod(Long resourceEntityId, Metric metric, long startInstant, long endInstant)
          Calculate the usage that accumulated for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and between the time period bounded by startInstant and endInstant.
 

Method Detail

addUsageReport

void addUsageReport(UsageReport report)
Process a usage report. Such a report usually will have been generated at an application service.

Parameters:
report - the report to porcess

addUsageReports

void addUsageReports(List<UsageReport> reports)
Process batch of usage reports. Each usage report usually will have been generated at an application service.

Parameters:
reports - the list of usage reports to process

getRate

double getRate(Long resourceEntityId,
               Metric metric,
               long instant)
Calculate the rate at an instant in time for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and at the given instant.

Parameters:
resourceEntityId - the entity id of the ResourceWithUsageByMetric
metric - the Metric of interest
instant - the time instant in milliseconds
Returns:
the rate at the time instant

getTotalPositiveRateChange

double getTotalPositiveRateChange(Long resourceEntityId,
                                  Metric metric,
                                  long startInstant,
                                  long endInstant)
Aggregate all positive rate changes between startInstant and endInstant for the ResourceWithUsageByMetric entity identified by resourceEntityId and for a particular metric.

Note that only positive rate changes are included in the result. Also, a rate change at startInstant is excluded whereas a rate change at endInstant is included.

Parameters:
resourceEntityId - the entity id of the ResourceWithUsageByMetric
metric - the Metric of interest
startInstant - the time instant in milliseconds at the start of the period
endInstant - the time instant in milliseconds at the end of the period
Returns:
the total of positive rate changes in the time period

getUsage

double getUsage(Long resourceEntityId,
                Metric metric,
                long instant)
Calculate the usage at an instant in time for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and at the given instant.

Parameters:
resourceEntityId - the entity id of the ResourceWithUsageByMetric
metric - the Metric of interest
instant - the time instant in milliseconds
Returns:
the usage at the time instant

getUsageInPeriod

double getUsageInPeriod(Long resourceEntityId,
                        Metric metric,
                        long startInstant,
                        long endInstant)
Calculate the usage that accumulated for the ResourceWithUsageByMetric entity identified by resourceEntityId for a particular Metric and between the time period bounded by startInstant and endInstant.

Parameters:
resourceEntityId - the entity id of the ResourceWithUsageByMetric
metric - the Metric of interest
startInstant - the time instant in milliseconds at the start of the period
endInstant - the time instant in milliseconds at the end of the period
Returns:
the usage that accumulated in the time period

getUsageElements

List<UsageSummaryElement> getUsageElements(Long resourceEntityId,
                                           Metric metric,
                                           long start,
                                           long end)
Get a list of UsageSummaryElements that represent a summary of usage for a metric on a particular resource. start and end are both optional and can be used to constrain by time, the range of elements returned.

Note that each UsageSummaryElement returned will have absolute rate and usage set correctly. This may be different from the representation in the database.

Parameters:
resourceEntityId - the entity id of the ResourceWithUsageByMetric
metric - the Metric of interest
start - the time at which to start the summary or -1 if the summary should start from the beginning
end - the time at which to end the summary or -1 if all elements from start onwards should be retrieved.
Returns:
a list of usage summary elements that together are a summary of usage

getMetricsForResource

List<Metric> getMetricsForResource(Long resourceEntityId)
Get a list of all Metrics used by the ResourceWithUsageByMetric identified by resourceEntityId.

Parameters:
resourceEntityId - the resource id for the owning ResourceWithUsageByMetric
Returns:
List of Metrics associated with the resource


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.