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

All Known Implementing Classes:
UsageSummaryFacadeImpl

public interface UsageSummaryFacade

Facade for methods related to usage report processing and querying usage.


Field Summary
static Object USAGE_SUMMARY_CREATION_LOCK
          Lock to use when creating usage summaries.
 
Method Summary
 void addActivityUsageReport(Long usageSummaryId, UsageReport report)
          Add a UsageReport to a usage summary uniquely identified by usageSummaryId.
 void addRate(Long usageSummaryId, long instant, double rateDelta)
          This can be used to add a rate directly to a UsageSummary at a particular instant.
 Map<ResourceAndMetric,Long> getOrCreateUsageSummaries(Set<ResourceAndMetric> resourceAndMetrics, Map<ResourceAndMetric,Throwable> errors)
          Get or create a UsageSummary instance, as required, for each of the ResourceWithMetric pairs in the resourceAndMetrics set.
 Long getOrCreateUsageSummary(Long resourceEntityId, Metric metric)
          Get or create a UsageSummary instance, as required.
 

Field Detail

USAGE_SUMMARY_CREATION_LOCK

static final Object USAGE_SUMMARY_CREATION_LOCK
Lock to use when creating usage summaries. This should be obtained and released outside of a transaction context.

Method Detail

getOrCreateUsageSummary

Long getOrCreateUsageSummary(Long resourceEntityId,
                             Metric metric)
Get or create a UsageSummary instance, as required.

Note that this method understands the ResourcePool-SLA-Activity hierarchy and will create a UsageSummary for each ancestor resource where appropriate.

Parameters:
resourceEntityId - the entity ID for the resource
metric - the metric
Returns:
the entity id of the UsageSummary
Throws:
RuntimeException - if there is no such entity with id resourceEntityId

getOrCreateUsageSummaries

Map<ResourceAndMetric,Long> getOrCreateUsageSummaries(Set<ResourceAndMetric> resourceAndMetrics,
                                                      Map<ResourceAndMetric,Throwable> errors)
Get or create a UsageSummary instance, as required, for each of the ResourceWithMetric pairs in the resourceAndMetrics set.

Note that this method understands the ResourcePool-SLA-Activity hierarchy and gets or creates a UsageSummary for each ancestor resource also.

Therefore, if an Activity and a Metric are passed as a ResourceAndMetric, three UsageSummarys will be retrieved or created: one each for the Activity, its parent SLA, and the SLAs parent ResourcePool's usagePool.

This method does not throw an exception if there is a ResourceAndMetric passed in the resourceAndMetrics argument for which there is no corresponding resource in the database. In this case, there will be no corresponding value in the returned Map.

Parameters:
resourceAndMetrics - the list of ResourceWithMetric pairs.
errors - Map of ResourceAndMetric to Throwable. If errors are generated when getting or retrieving a UsageSummary and entry is added to the map. This allows processing of other elements in the list to continue.
Returns:
map of ResourceAndMetric to UsageSummaryId:Long

addActivityUsageReport

void addActivityUsageReport(Long usageSummaryId,
                            UsageReport report)
Add a UsageReport to a usage summary uniquely identified by usageSummaryId.

Note that this method understands the ResourcePool-SLA-Activity hierarchy and adds the UsageReport for each ancestor resource also.

Parameters:
usageSummaryId - the ID for the UsageSummary
report - the usage report to add

addRate

void addRate(Long usageSummaryId,
             long instant,
             double rateDelta)
This can be used to add a rate directly to a UsageSummary at a particular instant. The rate delta will also be added to parent UsageSummarys.

Currently, this is used when creating an SLA and associating it with a ResourcePool's allocation pool only.



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