Fixing inheritance
This commit is contained in:
parent
28b6498967
commit
a11a3ba8e8
|
@ -10,7 +10,7 @@ import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregator.persistence.AggregatorPersistenceFactory;
|
import org.gcube.accounting.aggregator.persistence.AggregatorPersistenceFactory;
|
||||||
import org.gcube.accounting.aggregator.persistence.AggregatorPersistenceStatus;
|
import org.gcube.accounting.aggregator.persistence.AggregatorPersistenceSrc;
|
||||||
import org.gcube.accounting.aggregator.status.AggregationState;
|
import org.gcube.accounting.aggregator.status.AggregationState;
|
||||||
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
||||||
import org.gcube.accounting.aggregator.utility.Constant;
|
import org.gcube.accounting.aggregator.utility.Constant;
|
||||||
|
@ -64,8 +64,8 @@ public class Aggregator {
|
||||||
if(AggregationState.canContinue(aggregationStatus.getAggregationState(),AggregationState.STARTED)) {
|
if(AggregationState.canContinue(aggregationStatus.getAggregationState(),AggregationState.STARTED)) {
|
||||||
startTime = Utility.getUTCCalendarInstance();
|
startTime = Utility.getUTCCalendarInstance();
|
||||||
|
|
||||||
AggregatorPersistenceStatus aggregatorPersistenceStatus = AggregatorPersistenceFactory.getAggregatorPersistenceStatus();
|
AggregatorPersistenceSrc aggregatorPersistenceSrc = AggregatorPersistenceFactory.getAggregatorPersistenceSrc();
|
||||||
ResultSet resultSet = aggregatorPersistenceStatus.getResultSetOfRecordToBeAggregated(aggregationStatus);
|
ResultSet resultSet = aggregatorPersistenceSrc.getResultSetOfRecordToBeAggregated(aggregationStatus);
|
||||||
|
|
||||||
retrieveAndAggregate(resultSet);
|
retrieveAndAggregate(resultSet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package org.gcube.accounting.aggregator.persistence;
|
package org.gcube.accounting.aggregator.persistence;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public interface AggregatorPersistence extends AccountingPersistenceBackendQuery {
|
public interface AggregatorPersistence {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.gcube.documentstore.records.Record;
|
||||||
*/
|
*/
|
||||||
public interface AggregatorPersistenceDst extends AggregatorPersistence {
|
public interface AggregatorPersistenceDst extends AggregatorPersistence {
|
||||||
|
|
||||||
void insert(Record record);
|
public void insert(Record record) throws Exception;
|
||||||
|
|
||||||
void commitAndClose();
|
public void commitAndClose() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,13 @@ package org.gcube.accounting.aggregator.persistence;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
||||||
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public interface AggregatorPersistenceSrc extends AggregatorPersistence {
|
public interface AggregatorPersistenceSrc extends AggregatorPersistence, AccountingPersistenceBackendQuery {
|
||||||
|
|
||||||
public ResultSet getResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus) throws Exception;
|
public ResultSet getResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus) throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.accounting.aggregator.aggregation.AggregationType;
|
import org.gcube.accounting.aggregator.aggregation.AggregationType;
|
||||||
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
||||||
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public interface AggregatorPersistenceStatus extends AggregatorPersistence {
|
public interface AggregatorPersistenceStatus extends AggregatorPersistence, AccountingPersistenceBackendQuery {
|
||||||
|
|
||||||
public List<AggregationStatus> getUnterminated(String recordType, AggregationType aggregationType,
|
public List<AggregationStatus> getUnterminated(String recordType, AggregationType aggregationType,
|
||||||
Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart) throws Exception;
|
Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart) throws Exception;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.accounting.aggregator.status.AggregationStateEvent;
|
||||||
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
import org.gcube.accounting.aggregator.status.AggregationStatus;
|
||||||
import org.gcube.accounting.aggregator.utility.Constant;
|
import org.gcube.accounting.aggregator.utility.Constant;
|
||||||
import org.gcube.accounting.aggregator.utility.Utility;
|
import org.gcube.accounting.aggregator.utility.Utility;
|
||||||
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration;
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration;
|
||||||
import org.gcube.accounting.analytics.persistence.postgresql.AccountingPersistenceQueryPostgreSQL;
|
import org.gcube.accounting.analytics.persistence.postgresql.AccountingPersistenceQueryPostgreSQL;
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
|
@ -46,7 +47,7 @@ public class PostgreSQLConnector extends AccountingPersistenceQueryPostgreSQL im
|
||||||
|
|
||||||
protected Connection connection;
|
protected Connection connection;
|
||||||
|
|
||||||
protected PostgreSQLConnector(Class<? extends AggregatorPersistence> clazz) throws Exception {
|
protected PostgreSQLConnector(Class<? extends AccountingPersistenceBackendQuery> clazz) throws Exception {
|
||||||
this.configuration = new AccountingPersistenceBackendQueryConfiguration(clazz);
|
this.configuration = new AccountingPersistenceBackendQueryConfiguration(clazz);
|
||||||
Map<String, Class<? extends AggregatedRecord<?,?>>> aggregatedRecords = RecordUtility.getAggregatedRecordClassesFound();
|
Map<String, Class<? extends AggregatedRecord<?,?>>> aggregatedRecords = RecordUtility.getAggregatedRecordClassesFound();
|
||||||
for(String typeName : aggregatedRecords.keySet()) {
|
for(String typeName : aggregatedRecords.keySet()) {
|
||||||
|
|
|
@ -33,12 +33,12 @@ public class PostgreSQLConnectorDst implements AggregatorPersistenceDst {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insert(Record record) {
|
public void insert(Record record) throws Exception {
|
||||||
persistencePostgreSQL.insert(record);
|
persistencePostgreSQL.insert(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commitAndClose() {
|
public void commitAndClose() throws Exception {
|
||||||
persistencePostgreSQL.commitAndClose();
|
persistencePostgreSQL.commitAndClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue