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.AbstractAdminCustomMeteringService class defines methods to get recorded duration, to check whether usage entries exists, persist usage, retrieve usage and add usage.
-
-
Constructor Summary
Constructors Constructor Description CustomMeteringService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaddUsage(String userName, String duration, String measurement, long value)method 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 usageStringretrieveUsage(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
-
-
-
-
Method Detail
-
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- durationmeasurement- 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 namevalue- 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 nameduration- duration of the measurementmeasurement- measurement namevalue- usage value- Returns:
- usage value
- Throws:
Exception
-
-