uk.ac.soton.itinnovation.grid.service.sla.bizfacade
Class UsageReportFacadeImpl

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.sla.bizfacade.UsageReportFacadeImpl
All Implemented Interfaces:
UsageReportFacade

public class UsageReportFacadeImpl
extends Object
implements UsageReportFacade


Constructor Summary
UsageReportFacadeImpl()
           
 
Method Summary
 void addUsageReport(UsageReport report)
          Process a usage report.
 void addUsageReports(List<UsageReport> reports)
          Process batch of usage reports.
 ActivityFacade getActivityFacade()
           
 ReportProcessingErrorHandler getErrorHandler()
           
 List<Metric> getMetricsForResource(Long entityId)
          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.
 int getUsageReportBatchSize()
           
 UsageSummaryFacade getUsageSummaryFacade()
           
 UsageSummaryDAO getUsDao()
           
 UsageSummaryElementDAO getUseDao()
           
 void setActivityFacade(ActivityFacade activityFacade)
           
 void setErrorHandler(ReportProcessingErrorHandler errorHandler)
           
 void setUsageReportBatchSize(int usageReportBatchSize)
           
 void setUsageSummaryFacade(UsageSummaryFacade usageMethods)
           
 void setUsDao(UsageSummaryDAO usDao)
           
 void setUseDao(UsageSummaryElementDAO useDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsageReportFacadeImpl

public UsageReportFacadeImpl()
Method Detail

getUsageSummaryFacade

public UsageSummaryFacade getUsageSummaryFacade()

setUsageSummaryFacade

public void setUsageSummaryFacade(UsageSummaryFacade usageMethods)

getActivityFacade

public ActivityFacade getActivityFacade()

setActivityFacade

public void setActivityFacade(ActivityFacade activityFacade)

getUsageReportBatchSize

public int getUsageReportBatchSize()

setUsageReportBatchSize

public void setUsageReportBatchSize(int usageReportBatchSize)

getUsDao

public UsageSummaryDAO getUsDao()

setUsDao

public void setUsDao(UsageSummaryDAO usDao)

getUseDao

public UsageSummaryElementDAO getUseDao()

setUseDao

public void setUseDao(UsageSummaryElementDAO useDao)

getErrorHandler

public ReportProcessingErrorHandler getErrorHandler()

setErrorHandler

public void setErrorHandler(ReportProcessingErrorHandler errorHandler)

addUsageReport

public void addUsageReport(UsageReport report)
Description copied from interface: UsageReportFacade
Process a usage report. Such a report usually will have been generated at an application service.

Specified by:
addUsageReport in interface UsageReportFacade
Parameters:
report - the report to porcess

addUsageReports

public void addUsageReports(List<UsageReport> reports)
Description copied from interface: UsageReportFacade
Process batch of usage reports. Each usage report usually will have been generated at an application service.

Specified by:
addUsageReports in interface UsageReportFacade
Parameters:
reports - the list of usage reports to process

getRate

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

Specified by:
getRate in interface UsageReportFacade
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

public double getTotalPositiveRateChange(Long resourceEntityId,
                                         Metric metric,
                                         long startInstant,
                                         long endInstant)
Description copied from interface: UsageReportFacade
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.

Specified by:
getTotalPositiveRateChange in interface UsageReportFacade
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

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

Specified by:
getUsage in interface UsageReportFacade
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

public double getUsageInPeriod(Long resourceEntityId,
                               Metric metric,
                               long startInstant,
                               long endInstant)
Description copied from interface: UsageReportFacade
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.

Specified by:
getUsageInPeriod in interface UsageReportFacade
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

public List<UsageSummaryElement> getUsageElements(Long resourceEntityId,
                                                  Metric metric,
                                                  long start,
                                                  long end)
Description copied from interface: UsageReportFacade
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.

Specified by:
getUsageElements in interface UsageReportFacade
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

public List<Metric> getMetricsForResource(Long entityId)
Description copied from interface: UsageReportFacade
Get a list of all Metrics used by the ResourceWithUsageByMetric identified by resourceEntityId.

Specified by:
getMetricsForResource in interface UsageReportFacade
Parameters:
entityId - the resource id for the owning ResourceWithUsageByMetric
Returns:
List of Metrics associated with the resource


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