Interface DataSrc
public interface DataSrc
The interface that abstracts a data source responsible for managing connections to external data
services, such as databases, file systems, or messaging services.
It receives configuration for connecting to an external data service and then creates and
supplies a DataConn
instance, representing a single session connection.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the data source, releasing all resources and shutting down connections managed by this source.Creates and returns a newDataConn
instance, representing a single session connection to the external data service.void
setup
(AsyncGroup ag) Sets up the data source, performing any necessary initialization or configuration to establish connectivity to the external data service.
-
Method Details
-
setup
Sets up the data source, performing any necessary initialization or configuration to establish connectivity to the external data service. This method is typically called once at the application startup.- Parameters:
ag
- AnAsyncGroup
that can be used for asynchronous setup operations, especially if initialization is time-consuming.- Throws:
com.github.sttk.errs.Exc
- if an error occurs during the setup process.
-
close
void close()Closes the data source, releasing all resources and shutting down connections managed by this source. This method should be called when the application is shutting down to ensure proper resource cleanup. -
createDataConn
Creates and returns a newDataConn
instance, representing a single session connection to the external data service. Each call to this method should yield a new, independent connection.- Returns:
- A new
DataConn
instance for a session. - Throws:
com.github.sttk.errs.Exc
- if an error occurs while creating the data connection.
-