Added isConnectionActive() api

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@152763 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-09-06 14:12:15 +00:00
parent d409c4e97d
commit 390136c155
5 changed files with 28 additions and 24 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<ReleaseNotes>
<Changeset component="org.gcube.accounting.accounting-analytics.2-5-0" date="${buildDate}">
<Changeset component="org.gcube.accounting.accounting-analytics.2-6-0" date="${buildDate}">
<Change>Implemented isConnectionActive() api</Change>
</Changeset>
<Changeset component="org.gcube.accounting.accounting-analytics.2-5-0" date="2017-06-07">
<Change>Added api to sum StorageUsage values got from MapReduce avoiding the client to perform such a computation.</Change>
</Changeset>
<Changeset component="org.gcube.accounting.accounting-analytics.2-4-0" date="2016-03-16">

View File

@ -9,7 +9,7 @@
<groupId>org.gcube.accounting</groupId>
<artifactId>accounting-analytics</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<name>accounting-analytics</name>
<properties>

View File

@ -16,7 +16,6 @@ import org.gcube.accounting.analytics.UsageValue;
import org.gcube.accounting.analytics.exception.DuplicatedKeyFilterException;
import org.gcube.accounting.analytics.exception.KeyException;
import org.gcube.accounting.analytics.exception.ValueException;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
import org.gcube.documentstore.records.AggregatedRecord;
import org.json.JSONObject;
@ -60,8 +59,6 @@ public interface AccountingPersistenceBackendQuery {
throws DuplicatedKeyFilterException, KeyException, ValueException,
Exception;
/**
* Query the persistence obtaining a Map where the date is the key and the
* #Info is the value. The result is relative to an Usage Record Type,
@ -146,7 +143,6 @@ public interface AccountingPersistenceBackendQuery {
DuplicatedKeyFilterException, KeyException, ValueException,
Exception;
/**
* Same method but use if possible a map-reduce
@ -171,8 +167,6 @@ public interface AccountingPersistenceBackendQuery {
*/
public void close() throws Exception;
/**
* Return a sortedSet filter value
*
@ -193,7 +187,6 @@ public interface AccountingPersistenceBackendQuery {
TemporalConstraint temporalConstraint, List<Filter> filters,
String key) throws Exception;
/**
* Return a JsonObject with value
* e.g.for StorageUsageRecord {"dataVolume":1860328,"operationCount":4115}
@ -211,9 +204,8 @@ public interface AccountingPersistenceBackendQuery {
public JSONObject getUsageValue(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, Filter applicant)
throws Exception;
/**
/* *
*
* getUsageValueQuota
* use for a specifiy consumer id and for single quota
@ -284,7 +276,6 @@ public interface AccountingPersistenceBackendQuery {
public List<UsageValue> getUsageValueQuotaTotal(
List<UsageValue> listUsage)
throws Exception;
/**
* Return a SortedMap containing the TimeSeries for each context.
@ -299,7 +290,6 @@ public interface AccountingPersistenceBackendQuery {
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
throws Exception;
/**
* Return a record
* @param recordId
@ -316,18 +306,25 @@ public interface AccountingPersistenceBackendQuery {
*/
public SortedSet<String> getSpaceProvidersIds() throws Exception;
/**
*
* @param clz
* @param temporalConstraint
* @param filters
* @param providersId
* @return
* @throws Exception
*/
public SortedMap<Filter, SortedMap<Calendar, Long>> getSpaceTimeSeries(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
List<String> providersId) throws Exception;
/**
* @return
* @throws Exception
*/
boolean isConnectionActive() throws Exception;
}

View File

@ -23,7 +23,6 @@ import org.gcube.accounting.analytics.UsageValue;
import org.gcube.accounting.analytics.exception.DuplicatedKeyFilterException;
import org.gcube.accounting.analytics.exception.KeyException;
import org.gcube.accounting.analytics.exception.ValueException;
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
import org.gcube.documentstore.records.AggregatedRecord;
@ -63,7 +62,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
throws Exception {
AggregatedRecord<?,?> instance = clz.newInstance();
//limit filterky for accounting storage status (used from portlet accounting for tad space)
//limit filter key for accounting storage status (used from portlet accounting for tad space)
if (clz.equals(AggregatedStorageStatusRecord.class)){
SortedSet<String> storageStatus= new TreeSet<>();
storageStatus.add(AggregatedStorageStatusRecord.CONSUMER_ID);
@ -474,6 +473,11 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return unpaddedData;
}
@Override
public boolean isConnectionActive() throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().isConnectionActive();
}