|
|
|
@ -3,12 +3,9 @@
|
|
|
|
|
*/
|
|
|
|
|
package org.gcube.accounting.persistence;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import org.gcube.accounting.aggregator.RegexRulesAggregator;
|
|
|
|
|
import org.gcube.accounting.datamodel.BasicUsageRecord;
|
|
|
|
|
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
|
|
|
|
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
|
|
|
|
import org.gcube.documentstore.persistence.PersistenceBackendFactory;
|
|
|
|
@ -20,7 +17,10 @@ public class AccountingPersistenceFactory {
|
|
|
|
|
|
|
|
|
|
private AccountingPersistenceFactory(){}
|
|
|
|
|
|
|
|
|
|
protected final static Map<String, AccountingPersistence> persistences;
|
|
|
|
|
//protected final static Map<String, AccountingPersistence> persistences;
|
|
|
|
|
|
|
|
|
|
protected final static AccountingPersistence accountingPersistence;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void initAccountingPackages(){
|
|
|
|
|
PersistenceBackendFactory.addRecordPackage(ServiceUsageRecord.class.getPackage());
|
|
|
|
@ -28,7 +28,8 @@ public class AccountingPersistenceFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
persistences = new HashMap<String, AccountingPersistence>();
|
|
|
|
|
//persistences = new HashMap<String, AccountingPersistence>();
|
|
|
|
|
accountingPersistence = new AccountingPersistence(null);
|
|
|
|
|
initAccountingPackages();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -37,12 +38,14 @@ public class AccountingPersistenceFactory {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized static AccountingPersistence getPersistence() {
|
|
|
|
|
/*
|
|
|
|
|
String context = BasicUsageRecord.getContextFromToken();
|
|
|
|
|
AccountingPersistence accountingPersistence = persistences.get(context);
|
|
|
|
|
if(accountingPersistence==null){
|
|
|
|
|
accountingPersistence = new AccountingPersistence(context);
|
|
|
|
|
persistences.put(context, accountingPersistence);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
return accountingPersistence;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|