Class PostgreSQLConnector
- java.lang.Object
-
- org.gcube.documentstore.persistence.PersistenceBackend
-
- org.gcube.documentstore.persistence.PersistencePostgreSQL
-
- org.gcube.accounting.aggregator.persistence.PostgreSQLConnector
-
- All Implemented Interfaces:
AggregatorPersistence,AggregatorPersistenceDst,AggregatorPersistenceSrc,AggregatorPersistenceStatus
- Direct Known Subclasses:
PostgreSQLConnectorDst,PostgreSQLConnectorSrc,PostgreSQLConnectorStatus
public class PostgreSQLConnector extends org.gcube.documentstore.persistence.PersistencePostgreSQL implements AggregatorPersistenceSrc, AggregatorPersistenceDst, AggregatorPersistenceStatus
- Author:
- Luca Frosini (ISTI-CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.gcube.accounting.persistence.AccountingPersistenceConfigurationconfigurationprotected Connectionconnectionstatic StringDATETIME_PATTERNstatic TimeZoneDEFAULT_TIME_ZONE
-
Constructor Summary
Constructors Modifier Constructor Description protectedPostgreSQLConnector(Class<?> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteRecord(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode)voiddeleteRecords(org.gcube.com.fasterxml.jackson.databind.node.ArrayNode array)It must be implemented only and only if isBulkDeleteAllowed() return true.AggregationStatusgetAggregationStatus(String recordType, AggregationType aggregationType, Date aggregationStartDate)protected AggregationStatusgetAggregationStatusFromResultSet(ResultSet resultSet)List<AggregationStatus>getAll()protected ConnectiongetConnection()intgetEstimatedRecordRecordToBeAggregated(AggregationStatus aggregationStatus)protected StringgetInsertAggregationStateQuery(AggregationStatus aggregationStatus)protected StringgetInsertAggregationStatusQuery(AggregationStatus aggregationStatus, boolean upsert)AggregationStatusgetLast(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate)protected StringgetQuotedString(String string)ResultSetgetResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus)List<AggregationStatus>getUnterminated(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart)protected StringgetValue(Serializable serializable)booleanisBulkDeleteAllowed()voidupsertAggregationStatus(AggregationStatus aggregationStatus)-
Methods inherited from class org.gcube.documentstore.persistence.PersistencePostgreSQL
clean, closeConnection, commitAndClose, insert, isConnectionActive, openConnection, prepareConnection, reallyAccount
-
Methods inherited from class org.gcube.documentstore.persistence.PersistenceBackend
account, accountValidateAggregate, accountWithFallback, close, flush, flush, getAggregationScheduler, getFallbackPersistence, setAggregationScheduler, setFallback
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gcube.accounting.aggregator.persistence.AggregatorPersistenceDst
commitAndClose, insert
-
-
-
-
Field Detail
-
DATETIME_PATTERN
public static final String DATETIME_PATTERN
- See Also:
- Constant Field Values
-
DEFAULT_TIME_ZONE
public static final TimeZone DEFAULT_TIME_ZONE
-
configuration
protected org.gcube.accounting.persistence.AccountingPersistenceConfiguration configuration
-
connection
protected Connection connection
-
-
Method Detail
-
getConnection
protected Connection getConnection() throws Exception
- Throws:
Exception
-
getQuotedString
protected String getQuotedString(String string) throws SQLException
- Throws:
SQLException
-
getValue
protected String getValue(Serializable serializable) throws SQLException
- Throws:
SQLException
-
getInsertAggregationStatusQuery
protected String getInsertAggregationStatusQuery(AggregationStatus aggregationStatus, boolean upsert) throws SQLException
- Throws:
SQLException
-
getInsertAggregationStateQuery
protected String getInsertAggregationStateQuery(AggregationStatus aggregationStatus) throws SQLException
- Throws:
SQLException
-
upsertAggregationStatus
public void upsertAggregationStatus(AggregationStatus aggregationStatus) throws Exception
- Specified by:
upsertAggregationStatusin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
getAggregationStatusFromResultSet
protected AggregationStatus getAggregationStatusFromResultSet(ResultSet resultSet) throws Exception
- Throws:
Exception
-
getLast
public AggregationStatus getLast(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate) throws Exception
- Specified by:
getLastin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
getUnterminated
public List<AggregationStatus> getUnterminated(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart) throws Exception
- Specified by:
getUnterminatedin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
getAll
public List<AggregationStatus> getAll() throws Exception
- Specified by:
getAllin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
getAggregationStatus
public AggregationStatus getAggregationStatus(String recordType, AggregationType aggregationType, Date aggregationStartDate) throws Exception
- Specified by:
getAggregationStatusin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
deleteRecord
public void deleteRecord(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws Exception- Specified by:
deleteRecordin interfaceAggregatorPersistenceSrc- Throws:
Exception
-
getResultSetOfRecordToBeAggregated
public ResultSet getResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus) throws Exception
- Specified by:
getResultSetOfRecordToBeAggregatedin interfaceAggregatorPersistenceSrc- Throws:
Exception
-
getEstimatedRecordRecordToBeAggregated
public int getEstimatedRecordRecordToBeAggregated(AggregationStatus aggregationStatus) throws Exception
- Specified by:
getEstimatedRecordRecordToBeAggregatedin interfaceAggregatorPersistenceSrc- Throws:
Exception
-
isBulkDeleteAllowed
public boolean isBulkDeleteAllowed()
- Specified by:
isBulkDeleteAllowedin interfaceAggregatorPersistenceSrc
-
deleteRecords
public void deleteRecords(org.gcube.com.fasterxml.jackson.databind.node.ArrayNode array) throws UnsupportedOperationException, ExceptionDescription copied from interface:AggregatorPersistenceSrcIt must be implemented only and only if isBulkDeleteAllowed() return true. It must raise UnsupportedOperationException if bulk delete is not allowed- Specified by:
deleteRecordsin interfaceAggregatorPersistenceSrc- Throws:
UnsupportedOperationExceptionException
-
-