Package org.gcube.accounting.persistence
Class AccountingPersistenceConfiguration
java.lang.Object
org.gcube.documentstore.persistence.PersistenceBackendConfiguration
org.gcube.accounting.persistence.AccountingPersistenceConfiguration
public class AccountingPersistenceConfiguration
extends org.gcube.documentstore.persistence.PersistenceBackendConfiguration
The configuration of the accounting library, read from the Information System (Resource Registry):
the harmonization rules for
RegexRulesAggregator, the database for the database persistence
backend and for the consumers which are not persistence backends. Any other persistence backend gets
an empty configuration and discovers what it needs by itself.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Class<?>The class identifying the consumer requesting the configuration.protected static final Stringprotected static final StringThe only persistence backend configured by the databaseEServiceof the IS.static final Stringprotected static final Stringstatic final Stringstatic final StringFields inherited from class org.gcube.documentstore.persistence.PersistenceBackendConfiguration
properties -
Constructor Summary
ConstructorsConstructorDescriptionReads from the IS the configuration requested by the given class. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringReturns the name of the query template used to retrieve the database configuration from the Graph IS.booleanloadFromGraphIS(Class<?> clz) Loads the configuration requested by the given class from the Graph IS: the harmonization rules forRegexRulesAggregator; the database configuration for the database persistence backend ("PersistencePostgreSQL") and for consumers which are not persistence backends.Methods inherited from class org.gcube.documentstore.persistence.PersistenceBackendConfiguration
addProperty, getInstance, getProperty, toString
-
Field Details
-
TIMESCALEDB_QUERY_TEMPLATE_NAME
- See Also:
-
CONFIGURATION_QUERY
- See Also:
-
DATABASE_PERSISTENCE_BACKEND
The only persistence backend configured by the databaseEServiceof the IS. Every other persistence backend (e.g.PersistenceAccountingService) receives an empty configuration and discovers what it needs by itself: it never receives the database endpoint or credentials.- See Also:
-
URL_PROPERTY_KEY
- See Also:
-
USERNAME_PROPERTY_KEY
- See Also:
-
PASSWORD_PROPERTY_KEY
- See Also:
-
clz
The class identifying the consumer requesting the configuration. It is retained so that subclasses can select the proper query template viagetDatabaseQueryTemplateName().
-
-
Constructor Details
-
AccountingPersistenceConfiguration
public AccountingPersistenceConfiguration() -
AccountingPersistenceConfiguration
Reads from the IS the configuration requested by the given class.- Parameters:
clz- the class requesting the configuration- Throws:
Exception- if the IS cannot be queried or holds no configuration for the class
-
-
Method Details
-
loadFromGraphIS
Loads the configuration requested by the given class from the Graph IS: the harmonization rules forRegexRulesAggregator; the database configuration for the database persistence backend ("PersistencePostgreSQL") and for consumers which are not persistence backends. Any other persistence backend has no configuration: it is loaded empty, and the backend discovers what it needs by itself (e.g.PersistenceAccountingServicefinds the accounting service through the IS discovery library).- Parameters:
clz- the class requesting the configuration- Returns:
trueif the configuration was loaded,falseif the IS holds none- Throws:
Exception- if the Graph IS cannot be queried
-
getDatabaseQueryTemplateName
Returns the name of the query template used to retrieve the database configuration from the Graph IS. The base implementation returns the template of the accounting library. Consumers that read/write a different database (e.g. the analytics or the aggregator components) are expected to override this method to return their own template. The templates of the accounting stack (accounting-*) belong to the reference set installed by the Resource Registry: the library only runs them by name.- Returns:
- the query template name to execute for the database configuration
-