accounting-aggregator-se-pl.../src/main/java/org/gcube/accounting/aggregator/persistence/PostgreSQLConnectorDst.java

32 lines
1.1 KiB
Java

package org.gcube.accounting.aggregator.persistence;
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
import org.gcube.documentstore.persistence.PersistencePostgreSQL;
import org.gcube.documentstore.records.Record;
/**
* @author Luca Frosini (ISTI-CNR)
*/
public class PostgreSQLConnectorDst implements AggregatorPersistenceDst {
protected PersistencePostgreSQL persistencePostgreSQL;
protected PostgreSQLConnectorDst() throws Exception {
//AccountingPersistenceConfiguration accountingPersistenceConfiguration = new AccountingPersistenceConfiguration(PostgreSQLConnectorDst.class);
AccountingPersistenceConfiguration accountingPersistenceConfiguration = new AccountingPersistenceConfiguration(PersistencePostgreSQL.class);
persistencePostgreSQL = new PersistencePostgreSQL();
persistencePostgreSQL.prepareConnection(accountingPersistenceConfiguration);
}
@Override
public void insert(Record record) throws Exception {
persistencePostgreSQL.insert(record);
}
@Override
public void commitAndClose() throws Exception {
persistencePostgreSQL.commitAndClose();
}
}