public class AccountingPersistenceQueryCouchBase extends Object implements org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
| Modifier and Type | Field and Description |
|---|---|
protected static String |
AGGREGATED_PREFIX |
static long |
AUTO_RELEASE_AFTER |
protected com.couchbase.client.java.Cluster |
cluster |
protected org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration |
configuration |
static long |
CONNECTION_TIMEOUT |
static long |
CONNECTION_TIMEOUT_BUCKET |
protected Map<String,com.couchbase.client.java.Bucket> |
connectionMap |
protected static String |
DESIGN_DOC_ID |
static String |
DESIGN_DOC_ID_LIST_USAGE |
protected static com.couchbase.client.java.env.CouchbaseEnvironment |
ENV |
static long |
KEEP_ALIVE_INTERVAL |
protected static String |
KEYS_SEPARATOR |
protected static String |
MAP_REDUCE__DESIGN |
protected static String |
MAP_REDUCE_ALL |
static long |
MAX_REQUEST_LIFE_TIME |
static String |
PASSWORD_PROPERTY_KEY |
static String |
URL_PROPERTY_KEY |
static long |
VIEW_TIMEOUT_BUCKET |
| Constructor and Description |
|---|
AccountingPersistenceQueryCouchBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected com.couchbase.client.java.Bucket |
getBucket(Class<? extends org.gcube.accounting.datamodel.UsageRecord> clz) |
protected com.couchbase.client.java.Bucket |
getBucket(String recordType) |
protected Calendar |
getCalendar(org.json.JSONObject obj,
org.gcube.accounting.analytics.TemporalConstraint.AggregationMode aggregationMode) |
protected Calendar |
getCalendarFromArray(com.couchbase.client.java.document.json.JsonArray array) |
SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> |
getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
List<String> contexts)
Return a list of context time series (used for portlet accounting
context)
|
protected String |
getDesignDocId(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> recordClass)
Deprecated.
|
static String |
getDesignDocIdName(Collection<String> collection)
EXPERIMENTAL DEPRECATED generate a name of design doc id for a top
|
protected String |
getDesignDocIdSpecific(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> recordClass,
Collection<String> keys) |
SortedSet<org.gcube.accounting.analytics.NumberedFilter> |
getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String key)
Deprecated.
|
SortedSet<org.gcube.accounting.analytics.NumberedFilter> |
getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String key,
Integer limit)
Used for list a possible values for each filter
|
static String |
getMapReduceFunctionName(Collection<String> collection) |
static String |
getMapReduceFunctionNameTopMap(String top,
Collection<String> collection) |
SortedSet<org.gcube.accounting.analytics.NumberedFilter> |
getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String key,
String orderingProperty)
Calculate a next possible value with query (more slow but with fewer
resources )
|
SortedSet<org.gcube.accounting.analytics.NumberedFilter> |
getNextPossibleValuesWithMap(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String key,
String orderingProperty)
Calculate a next possible value with map (faster but with greater demand
for resources)
|
SortedMap<Calendar,org.gcube.accounting.analytics.Info> |
getNoContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters) |
protected String |
getQualifiedProperty(String property) |
protected com.couchbase.client.java.document.json.JsonArray |
getRangeKey(long time,
org.gcube.accounting.analytics.TemporalConstraint.AggregationMode aggregationMode,
boolean wildCard,
boolean endKey) |
String |
getRecord(String recordId,
String recordType) |
SortedSet<String> |
getSpaceProvidersIds()
Used for storage status aka tab Space (into portlet accounting) and
popolate a list combobox used
|
SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,Long>> |
getSpaceTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
List<String> providersId)
used for accounting portlet section storage status
|
protected String |
getSpecializedProperty(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
String property) |
SortedMap<Calendar,org.gcube.accounting.analytics.Info> |
getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters) |
SortedMap<org.gcube.accounting.analytics.NumberedFilter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> |
getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String topKey,
String orderingProperty) |
org.json.JSONObject |
getUsageValue(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
org.gcube.accounting.analytics.Filter applicant)
SPERIMENTAL now is not used
|
List<org.gcube.accounting.analytics.UsageValue> |
getUsageValueQuotaTotal(List<org.gcube.accounting.analytics.UsageValue> listUsage)
Used for calculate a usage value for each element of list (QUOTA)
|
boolean |
isConnectionActive() |
protected SortedMap<Calendar,org.gcube.accounting.analytics.Info> |
mapReduceQuery(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
org.gcube.accounting.analytics.TemporalConstraint temporalConstraint,
List<org.gcube.accounting.analytics.Filter> filters,
String context,
Boolean valueEmpty,
Boolean noScope) |
void |
prepareConnection(org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration) |
protected boolean |
usingNextPossibleValuesWithMap(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
String topKey,
List<org.gcube.accounting.analytics.Filter> filters)
SPERIMENTAL Used for verify if have exist map for calculate a top
|
public static final String URL_PROPERTY_KEY
public static final String PASSWORD_PROPERTY_KEY
protected static final com.couchbase.client.java.env.CouchbaseEnvironment ENV
public static final long MAX_REQUEST_LIFE_TIME
public static final long KEEP_ALIVE_INTERVAL
public static final long AUTO_RELEASE_AFTER
public static final long VIEW_TIMEOUT_BUCKET
public static final long CONNECTION_TIMEOUT_BUCKET
public static final long CONNECTION_TIMEOUT
protected org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration
protected com.couchbase.client.java.Cluster cluster
public static final String DESIGN_DOC_ID_LIST_USAGE
protected static final String MAP_REDUCE__DESIGN
protected static final String MAP_REDUCE_ALL
protected static final String KEYS_SEPARATOR
protected static final String DESIGN_DOC_ID
protected static final String AGGREGATED_PREFIX
public boolean isConnectionActive()
throws Exception
isConnectionActive in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic void prepareConnection(org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration)
throws Exception
prepareConnection in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionprotected com.couchbase.client.java.Bucket getBucket(Class<? extends org.gcube.accounting.datamodel.UsageRecord> clz) throws Exception
Exceptionprotected com.couchbase.client.java.Bucket getBucket(String recordType) throws Exception
Exceptionpublic void close()
throws Exception
close in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionprotected Calendar getCalendar(org.json.JSONObject obj, org.gcube.accounting.analytics.TemporalConstraint.AggregationMode aggregationMode) throws NumberFormatException, org.json.JSONException
NumberFormatExceptionorg.json.JSONExceptionprotected Calendar getCalendarFromArray(com.couchbase.client.java.document.json.JsonArray array) throws org.json.JSONException
org.json.JSONExceptionprotected com.couchbase.client.java.document.json.JsonArray getRangeKey(long time,
org.gcube.accounting.analytics.TemporalConstraint.AggregationMode aggregationMode,
boolean wildCard,
boolean endKey)
throws org.json.JSONException
org.json.JSONException@Deprecated protected String getDesignDocId(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> recordClass) throws InstantiationException, IllegalAccessException
protected String getDesignDocIdSpecific(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> recordClass, Collection<String> keys) throws InstantiationException, IllegalAccessException
public static String getMapReduceFunctionName(Collection<String> collection)
public static String getMapReduceFunctionNameTopMap(String top, Collection<String> collection)
public static String getDesignDocIdName(Collection<String> collection)
collection - protected SortedMap<Calendar,org.gcube.accounting.analytics.Info> mapReduceQuery(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String context, Boolean valueEmpty, Boolean noScope) throws Exception
Exceptionpublic SortedMap<Calendar,org.gcube.accounting.analytics.Info> getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters) throws Exception
getTimeSeries in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic SortedMap<Calendar,org.gcube.accounting.analytics.Info> getNoContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters) throws Exception
getNoContextTimeSeries in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic SortedMap<org.gcube.accounting.analytics.NumberedFilter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String topKey, String orderingProperty) throws Exception
getTopValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionprotected boolean usingNextPossibleValuesWithMap(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, String topKey, List<org.gcube.accounting.analytics.Filter> filters) throws Exception
clz - topKey - Exceptionpublic SortedSet<org.gcube.accounting.analytics.NumberedFilter> getNextPossibleValuesWithMap(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String key, String orderingProperty) throws Exception
getNextPossibleValuesWithMap in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - filters - key - orderingProperty - Exceptionpublic SortedSet<org.gcube.accounting.analytics.NumberedFilter> getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String key, String orderingProperty) throws Exception
getNextPossibleValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - filters - key - orderingProperty - Exceptionpublic SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, List<String> contexts) throws Exception
getContextTimeSeries in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - filters - contexts - Exceptionprotected String getSpecializedProperty(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, String property) throws Exception
Exception@Deprecated public SortedSet<org.gcube.accounting.analytics.NumberedFilter> getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String key) throws Exception
getFilterValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic SortedSet<org.gcube.accounting.analytics.NumberedFilter> getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, String key, Integer limit) throws Exception
getFilterValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - filters - key - Exceptionpublic org.json.JSONObject getUsageValue(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, org.gcube.accounting.analytics.Filter applicant) throws Exception
getUsageValue in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - applicant - Exceptionpublic List<org.gcube.accounting.analytics.UsageValue> getUsageValueQuotaTotal(List<org.gcube.accounting.analytics.UsageValue> listUsage) throws Exception
getUsageValueQuotaTotal in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuerylistUsage - Exceptionpublic String getRecord(String recordId, String recordType) throws Exception
getRecord in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic SortedSet<String> getSpaceProvidersIds() throws Exception
getSpaceProvidersIds in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryExceptionpublic SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,Long>> getSpaceTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, org.gcube.accounting.analytics.TemporalConstraint temporalConstraint, List<org.gcube.accounting.analytics.Filter> filters, List<String> providersId) throws Exception
getSpaceTimeSeries in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryclz - temporalConstraint - filters - providersId - org.json.JSONExceptionExceptionCopyright © 2017. All Rights Reserved.