Refactoring persistence to support src and dst
This commit is contained in:
parent
abec9f97f8
commit
750c5ebb19
|
@ -1,8 +1,10 @@
|
|||
package org.gcube.accounting.aggregator.persistence;
|
||||
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public interface AggregatorPersistence {
|
||||
public interface AggregatorPersistence extends AccountingPersistenceBackendQuery {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.accounting.aggregator.persistence;
|
||||
|
||||
import org.gcube.accounting.persistence.AccountingPersistenceConfiguration;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI-CNR)
|
||||
*/
|
||||
public class AggregatorPersitenceConfiguration extends AccountingPersistenceConfiguration {
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public AggregatorPersitenceConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param persistence The class of the persistence to instantiate
|
||||
* @throws Exception if fails
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public AggregatorPersitenceConfiguration(Class<?> persistence) throws Exception {
|
||||
super((Class) persistence);
|
||||
}
|
||||
|
||||
}
|
|
@ -46,17 +46,8 @@ public class PostgreSQLConnector extends AccountingPersistenceQueryPostgreSQL {
|
|||
|
||||
protected Connection connection;
|
||||
|
||||
private static PostgreSQLConnector postgreSQLConnector;
|
||||
|
||||
public static PostgreSQLConnector getPostgreSQLConnector() throws Exception {
|
||||
if(postgreSQLConnector == null) {
|
||||
postgreSQLConnector = new PostgreSQLConnector();
|
||||
}
|
||||
return postgreSQLConnector;
|
||||
}
|
||||
|
||||
private PostgreSQLConnector() throws Exception {
|
||||
this.configuration = new AccountingPersistenceBackendQueryConfiguration(AccountingPersistenceQueryPostgreSQL.class);
|
||||
protected PostgreSQLConnector(Class<? extends AggregatorPersistence> clazz) throws Exception {
|
||||
this.configuration = new AccountingPersistenceBackendQueryConfiguration(clazz);
|
||||
Map<String, Class<? extends AggregatedRecord<?,?>>> aggregatedRecords = RecordUtility.getAggregatedRecordClassesFound();
|
||||
for(String typeName : aggregatedRecords.keySet()) {
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.accounting.aggregator.persistence;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI-CNR)
|
||||
*/
|
||||
public class PostgreSQLConnectorDst extends PostgreSQLConnector implements AggregatorPersistenceDst {
|
||||
|
||||
protected PostgreSQLConnectorDst() throws Exception {
|
||||
super(AggregatorPersistenceDst.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.accounting.aggregator.persistence;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI-CNR)
|
||||
*/
|
||||
public class PostgreSQLConnectorSrc extends PostgreSQLConnector implements AggregatorPersistenceSrc {
|
||||
|
||||
protected PostgreSQLConnectorSrc(Class<? extends AggregatorPersistenceSrc> clazz) throws Exception {
|
||||
super(AggregatorPersistenceSrc.class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue