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
FieldsModifier and TypeFieldDescriptionprotected org.gcube.accounting.persistence.AccountingPersistenceConfigurationprotected Connectionstatic final Stringstatic final TimeZoneFields inherited from class org.gcube.documentstore.persistence.PersistencePostgreSQL
logger, statementMapFields inherited from class org.gcube.documentstore.persistence.PersistenceBackend
aggregationScheduler, fallbackPersistence, fallbackUseCounter, fallbackUseStartTime, forceFallbackUse, MAX_FALLBACK_RETRY, MAX_TIME_TO_FALLBACK, persistenceBackendMonitor, SHUTDOWN_SEND_WAIT_SECONDS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteRecord(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.getAggregationStatus(String recordType, AggregationType aggregationType, Date aggregationStartDate) protected AggregationStatusgetAggregationStatusFromResultSet(ResultSet resultSet) getAll()protected ConnectionintgetEstimatedRecordRecordToBeAggregated(AggregationStatus aggregationStatus) protected StringgetInsertAggregationStateQuery(AggregationStatus aggregationStatus) protected StringgetInsertAggregationStatusQuery(AggregationStatus aggregationStatus, boolean upsert) getLast(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate) protected StringgetQuotedString(String string) getResultSetOfRecordToBeAggregated(AggregationStatus aggregationStatus) getUnterminated(String recordType, AggregationType aggregationType, Date aggregationStartDate, Date aggregationEndDate, boolean forceRestart) protected StringgetValue(Serializable serializable) booleanvoidupsertAggregationStatus(AggregationStatus aggregationStatus) Methods inherited from class org.gcube.documentstore.persistence.PersistencePostgreSQL
clean, closeConnection, commitAndClose, insert, isConnectionActive, openConnection, prepareConnection, reallyAccountMethods inherited from class org.gcube.documentstore.persistence.PersistenceBackend
account, accountValidateAggregate, accountWithFallback, close, flush, flush, flushToFallback, getAggregationScheduler, getFallbackPersistence, reportUnknownOutcome, setAggregationScheduler, setFallback, startFallbackMonitorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gcube.accounting.aggregator.persistence.AggregatorPersistenceDst
commitAndClose, insert
-
Field Details
-
DATETIME_PATTERN
- See Also:
-
DEFAULT_TIME_ZONE
-
configuration
protected org.gcube.accounting.persistence.AccountingPersistenceConfiguration configuration -
connection
-
-
Constructor Details
-
PostgreSQLConnector
- Throws:
Exception
-
-
Method Details
-
getConnection
- Throws:
Exception
-
getQuotedString
- Throws:
SQLException
-
getValue
- 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
- Specified by:
upsertAggregationStatusin interfaceAggregatorPersistenceStatus- Throws:
Exception
-
getAggregationStatusFromResultSet
- 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
- 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, Exception Description 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
-