Fixing inheritance

This commit is contained in:
Luca Frosini 2024-02-06 12:38:15 +01:00
parent 28b6498967
commit a11a3ba8e8
7 changed files with 14 additions and 13 deletions

View File

@ -10,7 +10,7 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
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.AggregationStatus;
import org.gcube.accounting.aggregator.utility.Constant;
@ -64,8 +64,8 @@ public class Aggregator {
if(AggregationState.canContinue(aggregationStatus.getAggregationState(),AggregationState.STARTED)) {
startTime = Utility.getUTCCalendarInstance();
AggregatorPersistenceStatus aggregatorPersistenceStatus = AggregatorPersistenceFactory.getAggregatorPersistenceStatus();
ResultSet resultSet = aggregatorPersistenceStatus.getResultSetOfRecordToBeAggregated(aggregationStatus);
AggregatorPersistenceSrc aggregatorPersistenceSrc = AggregatorPersistenceFactory.getAggregatorPersistenceSrc();
ResultSet resultSet = aggregatorPersistenceSrc.getResultSetOfRecordToBeAggregated(aggregationStatus);
retrieveAndAggregate(resultSet);
}

View File

@ -1,10 +1,8 @@
package org.gcube.accounting.aggregator.persistence;
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public interface AggregatorPersistence extends AccountingPersistenceBackendQuery {
public interface AggregatorPersistence {
}

View File

@ -7,8 +7,8 @@ import org.gcube.documentstore.records.Record;
*/
public interface AggregatorPersistenceDst extends AggregatorPersistence {
void insert(Record record);
public void insert(Record record) throws Exception;
void commitAndClose();
public void commitAndClose() throws Exception;
}

View File

@ -3,12 +3,13 @@ package org.gcube.accounting.aggregator.persistence;
import java.sql.ResultSet;
import org.gcube.accounting.aggregator.status.AggregationStatus;
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public interface AggregatorPersistenceSrc extends AggregatorPersistence {
public interface AggregatorPersistenceSrc extends AggregatorPersistence, AccountingPersistenceBackendQuery {
public ResultSet getResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus) throws Exception;

View File

@ -5,11 +5,12 @@ import java.util.List;
import org.gcube.accounting.aggregator.aggregation.AggregationType;
import org.gcube.accounting.aggregator.status.AggregationStatus;
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public interface AggregatorPersistenceStatus extends AggregatorPersistence {
public interface AggregatorPersistenceStatus extends AggregatorPersistence, AccountingPersistenceBackendQuery {
public List<AggregationStatus> getUnterminated(String recordType, AggregationType aggregationType,
Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart) throws Exception;

View File

@ -23,6 +23,7 @@ import org.gcube.accounting.aggregator.status.AggregationStateEvent;
import org.gcube.accounting.aggregator.status.AggregationStatus;
import org.gcube.accounting.aggregator.utility.Constant;
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.postgresql.AccountingPersistenceQueryPostgreSQL;
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
@ -46,7 +47,7 @@ public class PostgreSQLConnector extends AccountingPersistenceQueryPostgreSQL im
protected Connection connection;
protected PostgreSQLConnector(Class<? extends AggregatorPersistence> clazz) throws Exception {
protected PostgreSQLConnector(Class<? extends AccountingPersistenceBackendQuery> clazz) throws Exception {
this.configuration = new AccountingPersistenceBackendQueryConfiguration(clazz);
Map<String, Class<? extends AggregatedRecord<?,?>>> aggregatedRecords = RecordUtility.getAggregatedRecordClassesFound();
for(String typeName : aggregatedRecords.keySet()) {

View File

@ -33,12 +33,12 @@ public class PostgreSQLConnectorDst implements AggregatorPersistenceDst {
}
@Override
public void insert(Record record) {
public void insert(Record record) throws Exception {
persistencePostgreSQL.insert(record);
}
@Override
public void commitAndClose() {
public void commitAndClose() throws Exception {
persistencePostgreSQL.commitAndClose();
}