SlaContract

public class SlaContract

Represents a SLA Contract containing a list of metrics. It follows the standard used by Amazon Cloudwatch.

The constants inside the class define the names of SLA Metrics supported in the JSON SLA Contract format.

Instances of this class can be created from a JSON file using the getInstanceInternal(InputStream) or getInstance(String) methods. This way, one doesn’t need to create instances of this class using its default constructor. This one is just used by the JSON parsing library.

For more details, check Raysa Oliveira’s Master Thesis (only in Portuguese).

Author:raysaoliveira

Constructors

SlaContract

public SlaContract()

Default constructor used to create a SlaContract instance. If you want to get a contract from a JSON file, you shouldn’t call the constructor directly. Instead, use some methods of the class methods.

This constructor is just provided to enable the Gson object to use reflection to instantiate a SlaContract.

See also: .getInstance(String)

Methods

getAvailabilityMetric

public SlaMetric getAvailabilityMetric()

getCpuUtilizationMetric

public SlaMetric getCpuUtilizationMetric()

getExpectedMaxPriceForSingleVm

public double getExpectedMaxPriceForSingleVm()

Gets the expected maximum price a single VM can cost, considering the Fault Tolerance Level.

Returns:the expected maximum price a single VM can cost for the given customer AwsEc2Template for the customer’s expected price

getFaultToleranceLevel

public SlaMetric getFaultToleranceLevel()

getInstance

public static SlaContract getInstance(String jsonFilePath)

Gets an SlaContract from a JSON file inside the application’s resource directory.

Parameters:
  • jsonFilePath – the relative path to the JSON file representing the SLA contract to read
Returns:

a SlaContract read from the JSON file

getMaxPrice

public double getMaxPrice()

Gets the maximum price a customer expects to pay hourly for all his/her running VMs.

getMetrics

public List<SlaMetric> getMetrics()
Returns:the metrics

getMinFaultToleranceLevel

public int getMinFaultToleranceLevel()

getPriceMetric

public SlaMetric getPriceMetric()

getTaskCompletionTimeMetric

public SlaMetric getTaskCompletionTimeMetric()

getWaitTimeMetric

public SlaMetric getWaitTimeMetric()

setMetrics

public void setMetrics(List<SlaMetric> metrics)
Parameters:
  • metrics – the metrics to set

toString

public String toString()