Class PersistenceAccountingService
java.lang.Object
org.gcube.documentstore.persistence.PersistenceBackend
org.gcube.documentstore.persistence.PersistenceAccountingService
public class PersistenceAccountingService
extends org.gcube.documentstore.persistence.PersistenceBackend
- Author:
- Alessandro Pieve (ISTI - CNR) alessandro.pieve@isti.cnr.it, Luca Frosini (ISTI - CNR) luca.frosini@isti.cnr.it, Biagio Peccerillo (ISTI - CNR) biagio.peccerillo@isti.cnr.it
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Stringstatic final StringFields 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 TypeMethodDescriptionprotected voidaccountWithFallback(org.gcube.documentstore.records.Record... records) protected voidclean()protected voidprotected static voidprotected StringBuildergetStringBuilder(InputStream inputStream) booleanprotected voidprotected StringparseHttpURLConnection(HttpURLConnection connection) protected voidprepareConnection(org.gcube.documentstore.persistence.PersistenceBackendConfiguration configuration) protected voidreallyAccount(org.gcube.documentstore.records.Record record) protected voidsend(org.gcube.documentstore.records.Record... records) Posts the records to the accounting service with the secret of the current thread.Methods inherited from class org.gcube.documentstore.persistence.PersistenceBackend
account, accountValidateAggregate, close, flush, flush, flushToFallback, getAggregationScheduler, getFallbackPersistence, reportUnknownOutcome, setAggregationScheduler, setFallback, startFallbackMonitor
-
Field Details
-
PATH_SERVICE_INSERT_ACCOUNTING
- See Also:
-
APPLICATION_JSON_CHARSET_UTF_8
- See Also:
-
URL_PROPERTY_KEY
- See Also:
-
SERVICE_CLASS
- See Also:
-
SERVICE_NAME
- See Also:
-
SERVICE_ENTRY_NAME
- See Also:
-
url
-
-
Constructor Details
-
PersistenceAccountingService
public PersistenceAccountingService()
-
-
Method Details
-
forceURL
-
prepareConnection
protected void prepareConnection(org.gcube.documentstore.persistence.PersistenceBackendConfiguration configuration) throws Exception - Specified by:
prepareConnectionin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
getStringBuilder
- Throws:
IOException
-
parseHttpURLConnection
protected String parseHttpURLConnection(HttpURLConnection connection) throws jakarta.ws.rs.WebApplicationException - Throws:
jakarta.ws.rs.WebApplicationException
-
send
Posts the records to the accounting service with the secret of the current thread. The library runs every persistence with its own credentials (document-store-libLibraryCredentials), so this is the library's secret for its working Context, not the secret of the caller which produced the records.A request which reached the service without a response status (e.g. the read timeout expired) has an unknown outcome: the service may have accounted the records. A request which received a success status is delivered, whatever happens afterwards.
- Parameters:
records- the records- Throws:
org.gcube.documentstore.exception.PersistenceOutcomeUnknownException- if the request reached the service but no response status was receivedException- if the records were not accounted
-
reallyAccount
- Specified by:
reallyAccountin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
accountWithFallback
protected void accountWithFallback(org.gcube.documentstore.records.Record... records) throws Exception - Overrides:
accountWithFallbackin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
openConnection
- Specified by:
openConnectionin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
closeConnection
- Specified by:
closeConnectionin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
isConnectionActive
- Specified by:
isConnectionActivein classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-
clean
- Specified by:
cleanin classorg.gcube.documentstore.persistence.PersistenceBackend- Throws:
Exception
-