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 -
Method Summary
Modifier and TypeMethodDescriptionlongmethod to add usage entriesString[]getRecordedDurations(String measurement) method to get recorded durationsbooleanisUsageEntryExists(String duration, String measurement) method to check whether usage entry exists or notvoidpersistUsage(String duration, String measurement, String value) method to persist usageretrieveUsage(String duration, String measurement) method to retrieve usageMethods inherited from class org.wso2.carbon.core.AbstractAdmin
getAxisConfig, getConfigContext, getConfigSystemRegistry, getConfigUserRegistry, getGovernanceRegistry, getGovernanceSystemRegistry, getGovernanceUserRegistry, getHttpSession, getLocalRepo, getRegistry, getTenantDomain, getUserId, getUsername, getUserRealm, setConfigurationContext, setPermissionUpdateTimestamp
-
Constructor Details
-
CustomMeteringService
public CustomMeteringService()
-
-
Method Details
-
getRecordedDurations
method to get recorded durations- Parameters:
measurement- the measurement name- Returns:
- duration array
- Throws:
Exception
-
isUsageEntryExists
method to check whether usage entry exists or not- Parameters:
duration- durationmeasurement- measurement name- Returns:
- true if usage entry exist
- Throws:
Exception
-
persistUsage
method to persist usage- Parameters:
duration-measurement- measurement namevalue- value of measurement- Throws:
Exception
-
retrieveUsage
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 nameduration- duration of the measurementmeasurement- measurement namevalue- usage value- Returns:
- usage value
- Throws:
Exception
-