Class CustomMeteringService

java.lang.Object
org.wso2.carbon.core.AbstractAdmin
org.wso2.carbon.usage.agent.services.CustomMeteringService

public class CustomMeteringService extends org.wso2.carbon.core.AbstractAdmin
CustomMeteringService class defines methods to get recorded duration, to check whether usage entries exists, persist usage, retrieve usage and add usage.
  • Field Summary

    Fields inherited from class org.wso2.carbon.core.AbstractAdmin

    axisConfig, configurationContext
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    addUsage(String userName, String duration, String measurement, long value)
    method to add usage entries
    method to get recorded durations
    boolean
    isUsageEntryExists(String duration, String measurement)
    method to check whether usage entry exists or not
    void
    persistUsage(String duration, String measurement, String value)
    method to persist usage
    retrieveUsage(String duration, String measurement)
    method to retrieve usage

    Methods inherited from class org.wso2.carbon.core.AbstractAdmin

    getAxisConfig, getConfigContext, getConfigSystemRegistry, getConfigUserRegistry, getGovernanceRegistry, getGovernanceSystemRegistry, getGovernanceUserRegistry, getHttpSession, getLocalRepo, getRegistry, getTenantDomain, getUserId, getUsername, getUserRealm, setConfigurationContext, setPermissionUpdateTimestamp

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomMeteringService

      public CustomMeteringService()
  • Method Details

    • getRecordedDurations

      public String[] getRecordedDurations(String measurement) throws Exception
      method to get recorded durations
      Parameters:
      measurement - the measurement name
      Returns:
      duration array
      Throws:
      Exception
    • isUsageEntryExists

      public boolean isUsageEntryExists(String duration, String measurement) throws Exception
      method to check whether usage entry exists or not
      Parameters:
      duration - duration
      measurement - measurement name
      Returns:
      true if usage entry exist
      Throws:
      Exception
    • persistUsage

      public void persistUsage(String duration, String measurement, String value) throws Exception
      method to persist usage
      Parameters:
      duration -
      measurement - measurement name
      value - value of measurement
      Throws:
      Exception
    • retrieveUsage

      public String retrieveUsage(String duration, String measurement) throws UsageException
      method to retrieve usage
      Parameters:
      duration -
      measurement - measurement name
      Returns:
      usage value
      Throws:
      UsageException
    • addUsage

      public long addUsage(String userName, String duration, String measurement, long value) throws Exception
      method to add usage entries
      Parameters:
      userName - user name
      duration - duration of the measurement
      measurement - measurement name
      value - usage value
      Returns:
      usage value
      Throws:
      Exception