Module service.database
Package service.database
Class AbstractDatabaseService<SCHEMA extends api.Schema,DATA,D,S,Q,U,I>
java.lang.Object
service.AbstractService
service.IdentifyableService
service.database.AbstractDatabaseService<SCHEMA,DATA,D,S,Q,U,I>
- Type Parameters:
SCHEMA- Type of schema to be used by the database connectionDATA- Type of data to be used by the database connectionD- Result type of queriesS- Type of the JSON parameter describing the schema for the "init" commandQ- Type of the JSON parameter describing the filter for database queriesU- Type of the JSON parameter describing the new data set of the "update" commandI- Type of the JSON response describing the result of all commands except the "query" command
- All Implemented Interfaces:
java.lang.AutoCloseable,service.Service
- Direct Known Subclasses:
SQLDatabaseService
public abstract class AbstractDatabaseService<SCHEMA extends api.Schema,DATA,D,S,Q,U,I>
extends service.IdentifyableService
Abstract implementation of a database service
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractDatabaseService.DataChanged<D>static classAbstractDatabaseService.QueryParameter<D>protected classAbstractDatabaseService.SubscriptionNested classes/interfaces inherited from class service.IdentifyableService
service.IdentifyableService.Status -
Field Summary
Fields Modifier and Type Field Description protected api.DatabaseConnection<SCHEMA,DATA>databaseConnectionprotected org.slf4j.LoggerLOGGER -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected abstract AbstractDatabaseService.DataChanged<D>dataChanged(java.lang.String operation, DATA oldData, DATA newData)protected abstract service.JsonResponse<service.IdentifyableService.Status,I>deleteFromDatabase(AbstractDatabaseService.QueryParameter<Q> parameter)protected abstract java.lang.StringgetDatabaseType()protected java.lang.StringgetServiceType()protected abstract service.JsonResponse<service.IdentifyableService.Status,I>init(AbstractDatabaseService.QueryParameter<S> parameter)protected abstract service.JsonResponse<service.IdentifyableService.Status,I>insertIntoDatabase(AbstractDatabaseService.QueryParameter<Q> parameter)protected voidonCustomCommand(java.lang.String command, java.net.Socket socket)protected abstract service.JsonResponse<service.IdentifyableService.Status,D>queryDatabase(AbstractDatabaseService.QueryParameter<Q> parameter)protected service.JsonResponse<service.IdentifyableService.Status,I>subscribe(AbstractDatabaseService.QueryParameter<Q> parameter, java.net.Socket socket)protected abstract service.JsonResponse<service.IdentifyableService.Status,I>subscriptionDone(java.util.List<AbstractDatabaseService.Subscription> subscriptionsAdded)protected abstract java.util.function.Predicate<DATA>translate(AbstractDatabaseService.QueryParameter<Q> parameter)protected service.JsonResponse<service.IdentifyableService.Status,I>unsubscribe(java.net.Socket socket)protected abstract service.JsonResponse<service.IdentifyableService.Status,I>unsubscriptionDone(java.util.List<AbstractDatabaseService.Subscription> subscriptionsToRemmove)protected abstract service.JsonResponse<service.IdentifyableService.Status,I>updateDatabase(AbstractDatabaseService.QueryParameter<U> parameter)
-
Field Details
-
LOGGER
protected final org.slf4j.Logger LOGGER -
databaseConnection
-
-
Constructor Details
-
Method Details
-
getServiceType
protected java.lang.String getServiceType()- Specified by:
getServiceTypein classservice.IdentifyableService
-
onCustomCommand
protected void onCustomCommand(java.lang.String command, java.net.Socket socket)- Specified by:
onCustomCommandin classservice.IdentifyableService
-
unsubscribe
protected service.JsonResponse<service.IdentifyableService.Status,I> unsubscribe(java.net.Socket socket) -
subscribe
protected service.JsonResponse<service.IdentifyableService.Status,I> subscribe(AbstractDatabaseService.QueryParameter<Q> parameter, java.net.Socket socket) -
dataChanged
protected abstract AbstractDatabaseService.DataChanged<D> dataChanged(java.lang.String operation, DATA oldData, DATA newData) -
translate
protected abstract java.util.function.Predicate<DATA> translate(AbstractDatabaseService.QueryParameter<Q> parameter) -
unsubscriptionDone
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> unsubscriptionDone(java.util.List<AbstractDatabaseService.Subscription> subscriptionsToRemmove) -
subscriptionDone
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> subscriptionDone(java.util.List<AbstractDatabaseService.Subscription> subscriptionsAdded) -
init
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> init(AbstractDatabaseService.QueryParameter<S> parameter) -
insertIntoDatabase
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> insertIntoDatabase(AbstractDatabaseService.QueryParameter<Q> parameter) -
updateDatabase
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> updateDatabase(AbstractDatabaseService.QueryParameter<U> parameter) -
deleteFromDatabase
protected abstract service.JsonResponse<service.IdentifyableService.Status,I> deleteFromDatabase(AbstractDatabaseService.QueryParameter<Q> parameter) -
queryDatabase
protected abstract service.JsonResponse<service.IdentifyableService.Status,D> queryDatabase(AbstractDatabaseService.QueryParameter<Q> parameter) -
getDatabaseType
protected abstract java.lang.String getDatabaseType()
-