Interface DataAcc
- All Known Implementing Classes:
DataHub
public interface DataAcc
Provides access to named
DataConn instances and nested logic execution within a data
access scope.
Application logic uses this interface (or a custom interface extending it) to retrieve managed data connections and to invoke sub-logic units within the same execution context.
-
Method Summary
Modifier and TypeMethodDescription<C extends DataConn>
CgetDataConn(String name, Class<C> cls) Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.<D> voidExecutes the specifiedLogicwithin the current data access context.start()Starts a sequentialLogicRunchain within the current data access context.
-
Method Details
-
getDataConn
Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.If a connection for the given
namealready exists in the current execution scope, that connection instance is returned. Otherwise, a new connection is created from the corresponding registeredDataSrc.- Type Parameters:
C- the expected type ofDataConn- Parameters:
name- the registered logical name of the data sourcecls- theClassrepresenting the target connection typeC- Returns:
- the data connection instance associated with the specified name
- Throws:
com.github.sttk.errs.Err- if no data source is registered forname, if creating the connection fails or returnsnull, or if the connection cannot be cast tocls
-
run
Executes the specifiedLogicwithin the current data access context.- Type Parameters:
D- the type of data access interface expected by the logic- Parameters:
logic- the logic unit to execute- Throws:
com.github.sttk.errs.Err- if an error occurs while executinglogic
-
start
-